spacetelescope / wfc3_dash

Tools for reducing HST/WFC3 DASH observations.
1 stars 5 forks source link

split_ima() output files have wrong data type and EXTVER, also lack distortion info #33

Open Vb2341 opened 5 years ago

Vb2341 commented 5 years ago

https://github.com/spacetelescope/wfc3_dash/blob/359a3e8908ea99e0132d1db439728618a44bf8dd/wfc3_dash/reduce_dash.py#L165

Because numpy's default dtype for arrays is float64 the precision of the SCI, ERR, and TIME arrays get stored with twice the precision they start with in the IMA. This isn't a huge deal overall, but it increases file size by a good chunk (I think ~60%) and for some reason, causes TweakReg to crash when attempting to find sources. Putting a .astype(np.float32) on the end of the data = science_data[5:-5,5:-5] and similar for the other two arrays should fix this.

The diff output files also have the EXTVER keyword set to whatever it was in the IMA for that extension. This also causes crashes in drizzlepac tools, as they can't find extension 'SCI', 1 as the EXTVER for all but one of the diff files is set to something >1. Manually setting the EXTVER to 1 fixes the crash.

Lastly, the diff files do not carry the distortion information in the headers of the SCI hdus. This causes a crash when attempting to align/drizzle the files. Running updatewcs() fixes that.

If, in practice drizzlepac, tools aren't going to be used for these reductions then most of this issue may not matter, but with these changes the files behave well with Drizzle.