-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add masking and limits to pstat #35
base: main
Are you sure you want to change the base?
Conversation
wfc3tools/pstat.py
Outdated
@@ -98,25 +164,41 @@ def pstat(filename, extname="sci", units="counts", stat="midpt", title=None, | |||
yend = myfile[1].header["NAXIS2"] # full y size | |||
|
|||
for i in range(1, nsamp, 1): | |||
data = myfile[extname.upper(), i].data[xstart:xend, ystart:yend] | |||
|
|||
# mask the data and remove outlyier values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo here, "outlier"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stscicrawford, would you like me to pull these changes and try a local test run? Downside to not having any testing setup :/
if data.size == 0: | ||
print("No valid pixels in ext {} of {}".format(i, imagename)) | ||
return xaxis, yaxis | ||
|
||
if "midpt" in stat: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it won't make a lot of difference to the code at this point in time, but I feel like these would be more clear as an elif
run for all the stat stuff. Since you're editing this file anyway it seems worth doing.
@@ -127,13 +209,14 @@ def pstat(filename, extname="sci", units="counts", stat="midpt", title=None, | |||
yaxis[i-1] *= exptime | |||
|
|||
if plot: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silly question, where does the plotting actually happen?
Correction, it does look like there's a test folder. Should we add a quick pstat test as part of this PR? |
Address comments from Sara
Tests will have to be added as a separate PR as it will likely be too much effort as part of this PR as it didn't have any testing previously. |
Added functionality to pstat that allows the use of a mask (based on a numpy.ndarray) and to specify high and low levels to limit the selection of the data for pstat.
Fixes #25 and #26