diff --git a/CHANGELOG.md b/CHANGELOG.md index dd3f6bbbe5c41fb2ab7a3f7a716280bc61015313..efb7dd03d36e8f02920a78cb5a603a1c883d1656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,10 @@ This changelog follows the specifications detailed in: [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), although we have not yet reached a `1.0.0` release. -## Version 0.7.6 - Unreleased +## Version 0.7.7 - Unreleased + + +## Version 0.7.6 - Released 2023-11-05 ## Version 0.7.5 - Released 2023-09-30 diff --git a/docs/source/conf.py b/docs/source/conf.py index 651a4539ec6ec3d9c8330624d91e1072b78ce21f..519bb603253eb6704c74180ace2339ca16cf4021 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -163,6 +163,9 @@ autoclass_content = 'both' # autoapi_dirs = [f'../../src/{modname}'] # autoapi_keep_files = True +# References: +# https://stackoverflow.com/questions/21538983/specifying-targets-for-intersphinx-links-to-numpy-scipy-and-matplotlib + intersphinx_mapping = { # 'pytorch': ('http://pytorch.org/docs/master/', None), 'python': ('https://docs.python.org/3', None), @@ -181,10 +184,20 @@ intersphinx_mapping = { 'scriptconfig': ('https://scriptconfig.readthedocs.io/en/latest/', None), 'rich': ('https://rich.readthedocs.io/en/latest/', None), + 'numpy': ('https://numpy.org/doc/stable/', None), + 'sympy': ('https://docs.sympy.org/latest/', None), + 'scikit-learn': ('https://scikit-learn.org/stable/', None), + 'pandas': ('https://pandas.pydata.org/docs/', None), + 'matplotlib': ('https://matplotlib.org/stable/', None), + 'pytest': ('https://docs.pytest.org/en/latest/', None), + 'platformdirs': ('https://platformdirs.readthedocs.io/en/latest/', None), + + 'timerit': ('https://timerit.readthedocs.io/en/latest/', None), + 'progiter': ('https://progiter.readthedocs.io/en/latest/', None), + 'dateutil': ('https://dateutil.readthedocs.io/en/latest/', None), # 'pytest._pytest.doctest': ('https://docs.pytest.org/en/latest/_modules/_pytest/doctest.html', None), # 'colorama': ('https://pypi.org/project/colorama/', None), - # 'numpy': ('http://docs.scipy.org/doc/numpy/', None), # 'cv2' : ('http://docs.opencv.org/2.4/', None), # 'h5py' : ('http://docs.h5py.org/en/latest/', None) } @@ -337,8 +350,10 @@ class PatchedPythonDomain(PythonDomain): """ def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode): # TODO: can use this to resolve references nicely - # if target.startswith('ub.'): - # target = 'ubelt.' + target[3] + if target.startswith('ub.'): + target = 'ubelt.' + target[3] + if target.startswith('xdoc.'): + target = 'xdoctest.' + target[3] return_value = super(PatchedPythonDomain, self).resolve_xref( env, fromdocname, builder, typ, target, node, contnode) return return_value @@ -545,8 +560,8 @@ class GoogleStyleDocstringProcessor: # import xdev # xdev.embed() - RENDER_IMAGES = 1 - if RENDER_IMAGES: + render_doc_images = 1 + if render_doc_images: # DEVELOPING if any('REQUIRES(--show)' in line for line in lines): # import xdev diff --git a/ndsampler/__init__.py b/ndsampler/__init__.py index 726133d1b6c133e04c2042123ed79c947758c3e0..3021b1966b0e2b2797d113022865e33c0ee71fb6 100644 --- a/ndsampler/__init__.py +++ b/ndsampler/__init__.py @@ -2,7 +2,7 @@ mkinit ~/code/ndsampler/ndsampler/__init__.py --diff mkinit ~/code/ndsampler/ndsampler/__init__.py -w """ -__version__ = '0.7.6' +__version__ = '0.7.7' from ndsampler.utils.util_misc import (HashIdentifiable,) diff --git a/ndsampler/coco_sampler.py b/ndsampler/coco_sampler.py index b9f44ae1b2336cebb8aea2d35cedb5262ba696ee..ccb4e4b95fc382733ca132bae98b638e222c9ca1 100644 --- a/ndsampler/coco_sampler.py +++ b/ndsampler/coco_sampler.py @@ -824,7 +824,20 @@ class CocoSampler(abstract_sampler.AbstractSampler, util_misc.HashIdentifiable, if target is None: raise ValueError('The target dictionary must be specified') + verbose_ndsample = target.get('verbose_ndsample', False) target_ = self._infer_target_attributes(target, **kwargs) + if verbose_ndsample: + print('Load Sample:') + print('target_ = {}'.format(ub.urepr(target_, nl=1))) + print('Load Sample Inferred:') + inferred_lines = [] + for k in target_: + v1 = target.get(k, None) + v2 = target_.get(k, None) + if v1 != v2: + inferred_lines.append(f'* {k}: {v1} -> {v2}') + print('\n'.join(inferred_lines)) + sample = self._load_slice(target_) if with_annots or ub.iterable(with_annots): @@ -1196,12 +1209,13 @@ class CocoSampler(abstract_sampler.AbstractSampler, util_misc.HashIdentifiable, if data_dims is None: _req_real_slice = requested_slice _req_extra_pad = [(0, 0), (0, 0)] + resolved_slice = requested_slice else: _req_real_slice, _req_extra_pad = kwarray.embed_slice(requested_slice, data_dims) - resolved_slice = tuple([ - slice(s.start - p_lo, s.stop + p_hi, s.step) - for s, (p_lo, p_hi) in zip(_req_real_slice, _req_extra_pad) - ]) + resolved_slice = tuple([ + slice(s.start - p_lo, s.stop + p_hi, s.step) + for s, (p_lo, p_hi) in zip(_req_real_slice, _req_extra_pad) + ]) channels = target_.get('channels', ub.NoParam) @@ -1717,7 +1731,10 @@ class CocoSampler(abstract_sampler.AbstractSampler, util_misc.HashIdentifiable, sample_box: kwimage.Boxes = params['sample_tlbr'] offset = params['offset'] data_dims = params['data_dims'] - space_dims = data_dims[-2:] + if data_dims is not None: + space_dims = data_dims[-2:] + else: + space_dims = None coco_dset = self.dset kp_classes = self.kp_classes diff --git a/pyproject.toml b/pyproject.toml index 0132ee861acac9b72f4534cc2baa3df6b6ea1ec1..45264246048914ececcaad521a1715475832e60a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,7 @@ ci_cpython_versions = ["3.6", "3.7", "3.8", "3.9", "3.10"] author = "Jon Crall" author_email = "jon.crall@kitware.com" description = "Fast sampling from large images" +render_doc_images = 1 url = "https://gitlab.kitware.com/computer-vision/ndsampler" license = "Apache 2" dev_status = "beta" diff --git a/requirements/docs.txt b/requirements/docs.txt index 57d0dabc2f0882636877f8a646503b5e810881a3..b14165e4888a8c6f91283b64a077dad8e474ad8a 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -6,3 +6,5 @@ sphinx-autoapi >= 1.8.4 Pygments >= 2.9.0 myst_parser >= 0.18.0 sphinx-reredirects >= 0.0.1 +xdoctest >= 1.1.2 +kwplot >= 0.4.15 diff --git a/requirements/tests.txt b/requirements/tests.txt index 5fec1f63fde226aadca1cdcb120f878150962e59..adf8d1f253dddc5420f29bb47b83b0b3f2c6a90f 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,5 +1,5 @@ pytest >= 6.2.4 coverage >= 5.2.1 -xdoctest >= 0.15.6 +xdoctest >= 1.1.2 pytest-cov >= 2.12.1 ; python_version >= '3.6.0' pytest-cov >= 2.0.0, < 2.6.0 ; python_version < '3.6.0'