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

IR tools #36

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

IR tools #36

wants to merge 6 commits into from

Conversation

cshanahan1
Copy link
Collaborator

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

@mackjenn
Copy link
Contributor

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

@stscicrawford
Copy link
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
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.


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

### temporary rename of file
Copy link
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


def _reprocess_raw_crcorr(raw_file):

"""Bookkeeping + call to calwf3 to make ima from raw, turning CRCORR switch off."""
Copy link
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


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
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

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.

None yet

3 participants