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

gain_corrected in ccd_process #491

Merged
merged 9 commits into from
Apr 25, 2017
Merged

Conversation

crawfordsm
Copy link
Member

This Fixes #490 and adds the option to include gain_corrected. If set to False, the calibrations files will be assumed to be un-gained corrected and the gain correction will only occur after those corrections are applied to the gain correction

For new functionality:

  • Did you add an entry to the "Changes.rst" file?
  • Did you include a meaningful docstring with Parameters, Returns and Examples?
  • Does the commit message include a "Fixes #issue_number" (replace "issue_number").
  • Did you include tests for the new functionality?
  • Does this PR add, rename, move or remove any existing functions or parameters?

Please note that the last point is not a requirement. It is meant as a check if
the pull request potentially breaks backwards-compatibility.


Default value for gain_corrected is True, which is inline with backward compatibility

@MSeifert04
Copy link
Contributor

MSeifert04 commented Apr 22, 2017

@crawfordsm It seems you're not linked to your commits. I had a similar issue lately and even though I don't know what exactly fixed it I bookmarked this github help page on "Commits are not linked to any user" - so I guess I found the answer there. Or is that intended?

@crawfordsm
Copy link
Member Author

Yes, apparently I've had my email set wrong on this new machine due to a typo -- I'm amazed by how many commits I've been allowed to make with that set wrong

@bsipocz
Copy link
Member

bsipocz commented Apr 22, 2017

@crawfordsm - You can add that email address to your github account, and the it will be recognized. Alternatively listing it in the .mailmap file may be enough, too.

@@ -915,3 +915,39 @@ def test_ccd_process():
assert(occd.unit == u.electron)
# Make sure the original keyword is still present. Regression test for #401
assert occd.meta['testkw'] == 100

def test_ccd_process_gain_corrected():
# test the through ccd_process
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence is missing something :)

CHANGES.rst Outdated
@@ -13,6 +13,10 @@ New Features
- Add ``bitfield_to_boolean_mask`` function to convert a ``bitfield`` to a
boolean mask (following the numpy conventions). [#460]

- Added ``gain_corrected`` option in ccd_process so that
Copy link
Contributor

Choose a reason for hiding this comment

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

Were the line breaks at 60 intentional?

ccdproc/core.py Outdated
@@ -262,6 +265,10 @@ def ccd_process(ccd, oscan=None, trim=None, error=False, master_bias=None,
raise TypeError(
'master_flat is not None or a CCDData object.')

# apply the gain correction only at the end if gain_corrected is False
if isinstance(gain, Quantity) and gain_corrected is False:
Copy link
Contributor

Choose a reason for hiding this comment

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

not gain_corrected seems better than gain_corrected is False and it would prevent accidentally not triggering the branch.

elif gain is None:
pass
else:
if not (gain is None or isinstance(gain, Quantity)):
Copy link
Contributor

Choose a reason for hiding this comment

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

the isinstance(gain, Quantity) is used 3 times in the function now. You could use an intermediate variable so it's only computed once.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, can be removed later on as it is already checked and simplified the code

@@ -165,6 +165,10 @@ def ccd_process(ccd, oscan=None, trim=None, error=False, master_bias=None,
If True, scale the dark frame by the exposure times.
Default is ``False``.

gain_corrected : bool, optional
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not exactly sure that's the best approach because the name could also mean that the "object" has been gain corrected.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is explained in the string describing what it is referring to

Copy link
Member

Choose a reason for hiding this comment

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

what about calling the parameter gain_corrected_masters?

ccdproc/core.py Outdated
@@ -165,6 +165,10 @@ def ccd_process(ccd, oscan=None, trim=None, error=False, master_bias=None,
If True, scale the dark frame by the exposure times.
Default is ``False``.

gain_corrected : bool, optional
If True, the calibration frames have already been gain corrected.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a hint which parameters correspond to the "calibration frames" could be added.

@mwcraig mwcraig merged commit 996eaac into astropy:master Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants