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

DM-27103: Not all IsrCalib tests round trip calibrations #178

Merged
merged 4 commits into from Apr 29, 2021

Conversation

czwa
Copy link
Contributor

@czwa czwa commented Apr 2, 2021

This fixes the missing tests, and enhances the base class eq to reduce code duplication.

return False

for attr in self._requiredAttributes:
if getattr(self, attr) != getattr(other, attr):
attrSelf = getattr(self, attr)
Copy link
Contributor

Choose a reason for hiding this comment

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

The big change in this ticket is to make the eq method general, by being part of calibType, correct? I see that you deleted the eq in the PTC and BFK code. Were these the only calibrations that had a customized eq?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Since they were doing essentially the same kind of checks, it made sense to collect them in the base class __eq__ so any future calibs will have a functional equivalence with no extra work.

Comment on lines +342 to +346
if 'CT_ERRORS' in coeffTable.columns:
inDict['coeffErr'] = coeffTable['CT_ERRORS']
if 'CT_COUNTS' in coeffTable:
if 'CT_COUNTS' in coeffTable.columns:
inDict['coeffNum'] = coeffTable['CT_COUNTS']
if 'CT_VALID' in coeffTable:
if 'CT_VALID' in coeffTable.columns:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why now do you have to check coeffTable.columns instead of just coeffTable? Is this the only place where this needs to be changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without the change, astropy throws a
astropy/table/row.py:76: FutureWarning: elementwise == comparison failed and returning scalar instead; this will raise an error or perform elementwise comparison in the future. return self.as_void() == other warning that I found annoying. I don't know why checking inclusion requires an __eq__ run on the row, and didn't care to dig deeper. Checking the .columns attribute should have the same behavior, and as it isn't calling whatever the other style is calling, it probably runs infinitesimally faster.

Copy link
Contributor

@plazas plazas left a comment

Choose a reason for hiding this comment

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

Looks good, just two minor questions asking for clarificaton.

- Did not set detectorId from an inherited detector.
- Did not set ERROR, NUM, and VALID fields when inheriting from a detector.
- Look for table names in astropy Table.columns to avoid an annoying warning.
@czwa czwa merged commit 669e18e into master Apr 29, 2021
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

2 participants