LM-SAL / aiapy

Python library for AIA data analysis
https://aiapy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

Allow user specified dtype to normalize_exposure - [closed] #211

Closed nabobalis closed 10 months ago

nabobalis commented 3 years ago

In GitLab by @dstansby1 on Oct 6, 2020, 12:37

Merges dtype -> master

This allows the user to specify a dtype for the output data if they would like. This allows specification of e.g. np.float32 to reduce the memory consumption of a single AIAMap from ~100MB to ~50MB.

nabobalis commented 3 years ago

In GitLab by @codecov on Oct 6, 2020, 12:47

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@7602268). Click here to learn what that means. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #87   +/-   ##
=========================================
  Coverage          ?   97.21%           
=========================================
  Files             ?       14           
  Lines             ?      431           
  Branches          ?        0           
=========================================
  Hits              ?      419           
  Misses            ?       12           
  Partials          ?        0           
Impacted Files Coverage Δ
aiapy/calibrate/prep.py 98.07% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7602268...786fefd. Read the comment docs.

nabobalis commented 3 years ago

In GitLab by @wtbarnes on Oct 6, 2020, 15:13

I'm not necessarily opposed to this, but is this not an issue any time we do any floating point operation on a map? I guess I would just be more inclined for a user to handle this themselves, e.g.

smap = sunpy.map.Map(smap.data.astype(np.float32), smap.meta)

It's not really that I'm opposed to having it here, but if we're going to put it here, why not put it into every function that operates on a map? I don't think we do any explicit typecasting anywhere in sunpy? But I may be wrong.

nabobalis commented 3 years ago

In GitLab by @dstansby1 on Oct 7, 2020, 02:02

That's a good point. I think it might be nice to add a gallery example explaining how input maps are typically int16, but get cast to float64 when doing certain operations, and showing users how to use the line of code in your comment to reduce memory consumption.