Skip to content

Add numpy print option in order to prevent showing the datatype - #46

Open
s-henao-castellanos wants to merge 1 commit into
European-XFEL:masterfrom
s-henao-castellanos:numpy-printoptions-legacy
Open

Add numpy print option in order to prevent showing the datatype #46
s-henao-castellanos wants to merge 1 commit into
European-XFEL:masterfrom
s-henao-castellanos:numpy-printoptions-legacy

Conversation

@s-henao-castellanos

Copy link
Copy Markdown

Add numpy print option in order to prevent showing the datatype on each print.

The relevant portion of the numpy documentation states that setting legacy='1.25':

[...] means that numeric scalars are printed without their type information, e.g. as 3.0 rather than np.float64(3.0).

…ch print.

The relevant portion of the numpy documentation states that setting `legacy='1.25'`:

> [...] means that numeric scalars are printed without their type information, e.g. as `3.0` rather than `np.float64(3.0)`.
@codecov

codecov Bot commented Mar 5, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.89%. Comparing base (c39929e) to head (e302eda).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #46      +/-   ##
==========================================
+ Coverage   70.84%   70.89%   +0.05%     
==========================================
  Files           9        9              
  Lines         559      560       +1     
==========================================
+ Hits          396      397       +1     
  Misses        163      163              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@takluyver

Copy link
Copy Markdown
Member

Thanks! Ideally we should avoid changing this setting globally when people import h5glance. We're already setting some other print options here, I think this can join them:

numpy.set_printoptions(threshold=numpy.inf)
if sys.stdout.isatty():
numpy.set_printoptions(linewidth=get_terminal_size()[0])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants