Skip to content

IR tools#36

Open
cshanahan1 wants to merge 6 commits into
spacetelescope:mainfrom
cshanahan1:ir_tools
Open

IR tools#36
cshanahan1 wants to merge 6 commits into
spacetelescope:mainfrom
cshanahan1:ir_tools

Conversation

@cshanahan1

@cshanahan1 cshanahan1 commented Oct 26, 2018

Copy link
Copy Markdown
Contributor

added ir_tools.py, with ramp-flattening function. will populate this with more functions (discussed on hack day) shortly.

Fix #38

@mackjenn

Copy link
Copy Markdown
Contributor

@sosey @stscicrawford What is the process forward to merge this into wfc3tools?

@stscicrawford

Copy link
Copy Markdown
Contributor

It will need to be reviewed -- if you can confirm it works how you would like, I'll provide a code by the end of the week as I think this was submitted as part of the hack day.

@stscicrawford

Copy link
Copy Markdown
Contributor

I've left a few minor comments on here for review, but if there isn't time to address them, I would be okay to merge as is, but then open issues for them to be addressed in the future.

It isn't required, but if there was any tests, it would be useful to add them as well.

So if this is something that you would like available urgently, I would be okay to merge.

Comment thread wfc3tools/wfc3ir_tools.py

"""Bookkeeping + call to calwf3 to make ima from raw, turning CRCORR switch off."""

### temporary rename of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to use the temp file rather than giving it a specific name in the case where 'temp_'+rawfile might exist before hand

Comment thread wfc3tools/wfc3ir_tools.py

def _reprocess_raw_crcorr(raw_file):

"""Bookkeeping + call to calwf3 to make ima from raw, turning CRCORR switch off."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still would be good to have the input parameters listed here even for private functions

Comment thread wfc3tools/wfc3ir_tools.py

def _calc_avg(data, stats_method, sigma_clip, sigma, sigma_upper, sigma_lower, iters):
""" Returns a mean or median from an array, with optional sigma clipping."""
if not sigma_clip:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be simplified with the following code:

mean, med, s = sigma_clipped_stats(data, sigma = sigma, sigma_lower = sigma_lower, 
                                    	   sigma_upper = sigma_upper, iters = iters)
if stats_method == 'median':
	return med
return mean

And sigma_clip is set to False, then requiring iters=0

@pllim

pllim commented Oct 21, 2025

Copy link
Copy Markdown
Collaborator

@cshanahan1 and @mackjenn , is this PR still relevant after 7 years?

@mackjenn

Copy link
Copy Markdown
Contributor

Yes, this is still an issue. It is important for the workflow in this notebook, e.g. for datasets where ASN_ID = None (for example, when observations in the same filter are taken with dithered POS-TARGs and not with dither patterns.)

https://spacetelescope.github.io/hst_notebooks/notebooks/WFC3/tvb_flattenramp/TVB_flattenramp_notebook.html

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.

calwf3 fails when attempting to resume processing on a 'flattened' IMA file if ASN_ID=None

4 participants