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

Add masking and limits to pstat #35

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

Conversation

stscicrawford
Copy link
Contributor

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

@stscicrawford stscicrawford requested a review from SaOgaz October 11, 2018 17:18
@@ -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
Copy link

Choose a reason for hiding this comment

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

Small typo here, "outlier"

Copy link

@SaOgaz SaOgaz left a 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:
Copy link

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:
Copy link

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?

@SaOgaz
Copy link

SaOgaz commented Oct 11, 2018

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

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.

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.

2 participants