| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Sorry, something went wrong.
|
@ianhi could you take a look at the why-an-index notebook when you can? |
Sorry, something went wrong.
|
Posted #376 . In order to get the build to pass here (and in main) we should either fix this notebook or exclude it from executing during build. Unfortunately I've been really struggling to do the latter. # config.yaml
execute:
execute_notebooks: 'cache'
+ exclude_patterns: ["intermediate/indexing/why-an-index.ipynb"]doesn't work despite it being valid config (perhaps its due to us using v1 of jupyterbook which is in maintenance mode?) |
Sorry, something went wrong.
|
Seems like a bug in Jupyterbook - if you have time to look at the original notebook @ianhi that would be great :) claude suggested a fix of def sel(self, labels, method=None, tolerance=None):
- # labels : {coord_name: query} e.g. .sel(angle=370) -> {"angle": 370}
- # return : IndexSelResult({dim_name: [position]}) position = int row into the axis
- print("sel received:", labels)
- # the stored labels (one period) are self._index.index.to_numpy()
- pos = 0 # <- replace: circular distance -> nearest position
- return IndexSelResult({self._index.dim: [pos]})
+ (name, label), = labels.items()
+ base = self._index.index.to_numpy()
+ q = np.asarray(label, dtype=float)
+ if q.ndim == 0:
+ d = np.abs((q - base + self.period / 2) % self.period - self.period / 2)
+ pos = int(d.argmin())
+ return IndexSelResult({self._index.dim: [pos]})
+ else:
+ positions = []
+ for qi in q:
+ d = np.abs((qi - base + self.period / 2) % self.period - self.period / 2)
+ positions.append(int(d.argmin()))
+ return IndexSelResult({self._index.dim: positions}) |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
cc @eni-awowale @ianhi