Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make scico.DType type more specific #165

Closed
Michael-T-McCann opened this issue Jan 10, 2022 · 2 comments · Fixed by #415
Closed

Make scico.DType type more specific #165

Michael-T-McCann opened this issue Jan 10, 2022 · 2 comments · Fixed by #415
Labels
enhancement New feature or request priority: low Low priority

Comments

@Michael-T-McCann
Copy link
Contributor

Right now, arguments of type scico.DType can be anything:

DType = Any # TODO: can we do better than this? Maybe with the new numpy typing?

It would be more useful for automated type checking to set this to the types we intend to support. As a first guess, I'd say Union[np.float32, np.float64, np.complex64].

@Michael-T-McCann Michael-T-McCann added the priority: low Low priority label Jan 10, 2022
@lukepfister
Copy link
Contributor

iirc I didn’t push any further on this because DType is aliases to Any inside of jax

@bwohlberg
Copy link
Collaborator

bwohlberg commented May 9, 2023

See jaxtyping. Also, note that all numpy supported dtypes are listed in numpy.sctypes. Jax only supports the numeric dtypes of length 64 or smaller, and the bool dtype.

Also, see numpy.typing, which includes ArrayLike and DTypeLike types.

bwohlberg added a commit that referenced this issue May 9, 2023
@bwohlberg bwohlberg mentioned this issue May 9, 2023
bwohlberg added a commit that referenced this issue May 15, 2023
* Add function for computing gaussian distribution

* Typing fix and better default sigma

* Address #165

* Fix docs typos and suppress apparently-spurious type error

* Target clean also cleans _autosummary directory

* Use new TypeAlias declaration

* Suppress type error

* Avoid pollution of docs with excessively long type alias definition

* Add comment as per PR review suggestion
Michael-T-McCann pushed a commit that referenced this issue May 19, 2023
* Resolve #261 (#416)

* Improve markup for numpy.float32 etc. as well as some other docs improvements

* Add note to style docs

* Minor docs edit

* Some markup changes

* Resolve #165 (#415)

* Add function for computing gaussian distribution

* Typing fix and better default sigma

* Address #165

* Fix docs typos and suppress apparently-spurious type error

* Target clean also cleans _autosummary directory

* Use new TypeAlias declaration

* Suppress type error

* Avoid pollution of docs with excessively long type alias definition

* Add comment as per PR review suggestion

* Resolve #83 (#417)

* Attempt to remove rtd edit on github button

* Bump jaxlib/jax max versions

* Remove function no longer in jax.numpy

* Resolve #377 (#418)

* Fix markup

* Docstring edits

* Change sphinx theme

* Docstring fixes

* Theme customization

* Clean up

* Fix inheritance diagram insertion

* Resolve document not in any toctree warning for index.ipynb

* Clean up

* Update submodule

* Adjust css

* Avoid problems with dark mode

* Add version number in sidebar

* Change inheritance diagram color scheme

* Clean up

* Correct path to docs_requirements

---------

Co-authored-by: Thilo Balke <thilo.balke@gmail.com>

* Implement PR review recommendations

---------

Co-authored-by: Thilo Balke <thilo.balke@gmail.com>
Michael-T-McCann added a commit that referenced this issue May 19, 2023
* Rename test file

* Add function and tests

* Replace try-and-see code with new function

* Implement #419 review recommendations (#421)

* Resolve #261 (#416)

* Improve markup for numpy.float32 etc. as well as some other docs improvements

* Add note to style docs

* Minor docs edit

* Some markup changes

* Resolve #165 (#415)

* Add function for computing gaussian distribution

* Typing fix and better default sigma

* Address #165

* Fix docs typos and suppress apparently-spurious type error

* Target clean also cleans _autosummary directory

* Use new TypeAlias declaration

* Suppress type error

* Avoid pollution of docs with excessively long type alias definition

* Add comment as per PR review suggestion

* Resolve #83 (#417)

* Attempt to remove rtd edit on github button

* Bump jaxlib/jax max versions

* Remove function no longer in jax.numpy

* Resolve #377 (#418)

* Fix markup

* Docstring edits

* Change sphinx theme

* Docstring fixes

* Theme customization

* Clean up

* Fix inheritance diagram insertion

* Resolve document not in any toctree warning for index.ipynb

* Clean up

* Update submodule

* Adjust css

* Avoid problems with dark mode

* Add version number in sidebar

* Change inheritance diagram color scheme

* Clean up

* Correct path to docs_requirements

---------

Co-authored-by: Thilo Balke <thilo.balke@gmail.com>

* Implement PR review recommendations

---------

Co-authored-by: Thilo Balke <thilo.balke@gmail.com>

---------

Co-authored-by: Brendt Wohlberg <bwohlberg@users.noreply.github.com>
Co-authored-by: Thilo Balke <thilo.balke@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: low Low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants