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

Fix obs_comCam from not-working to working-to-first-order. #2

Merged
merged 1 commit into from Aug 1, 2017

Conversation

mfisherlevine
Copy link
Contributor

The commit includes fixes to:
Fix retargetting of task.
Change ccd datatype from int to text
Add wavelength translator and fix up the ingest
Add config files for calib construction
Add ccd number to template for calibs
Add call to makeRawVisitInfo.getDarkTime() for getting the darkTime correctly
Remove errant .gz suffixes from the policy file

Copy link

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

See comments.

argDict["darkTime"] = self.popFloat(md, "DARKTIME")
#
# Done setting argDict; check values now that all the header keywords have been consumed
#

Choose a reason for hiding this comment

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

No need for enclosing empty comment lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, honestly, that was Robert's comment, and he always does that, I don't know why. Removed.


Returns
-------
phuInfo : `dict`

Choose a reason for hiding this comment

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

Can we not call this phuInfo, please? How about primaryHDUDict?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy to change this, but this was a conscious decision to adhere to the same naming scheme as the base class, and to be the same as other ingest.getInfo() methods in other obs_packages. Would you really like me to change this if it means no longer having that symmetry?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, give that these objects are instantiated by a call to the base class (first line), keeping the same variable names as those returned seems neat, and doing otherwise might cause more confusion than using better names would save, IMO.

Choose a reason for hiding this comment

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

I agree with you both here: this name is terrible, but consistency is important. My take is that the latter wins for the purposes of this ticket.

Choose a reason for hiding this comment

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

Ugh. Can you file a ticket to fix the name in the base class then, please? Consistency is ok for this work, but that name is terrible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugh indeed. See DM-11428 for the ticket that was just born though 🙂

phuInfo : `dict`
Dictionary containing the header keys defined in the ingest config from the primary HDU
infoList : `list`
A list of dictionaries containing the phuInfo(s)

Choose a reason for hiding this comment

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

I'm confused how this is different from the above (and also, phuInfo name again...).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the case of single extension files, it's a dict, and a [dict], otherwise the second object is a list of dictionaries containing header data. I agree it's not very nice, but again, it's inheriting this structure from the base class. All this should be cleaned up in the Great Obs Package Redesign, but for now I think this is how it has to be 😔

Choose a reason for hiding this comment

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

Can we at least document this better? I wouldn't have been able to derive (at least, not with any certainty) your explanation above from looking at the docstring.

Choose a reason for hiding this comment

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

Yes, what other John said.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I think my new docstring should make this clear. Shout if you disagree (and let's hope it's temporary anyway)

phuInfo, infoList = ParseTask.getInfo(self, filename)

pathname, basename = os.path.split(filename)
basename = re.sub(r"\.(%s)$" % "|".join(EXTENSIONS), "", basename)
phuInfo['basename'] = basename
#
# Now pull the sensor ID from the path (no, it's not in the header)
# Now pull the acq type & jobID from the path (no, they're not in the header)

Choose a reason for hiding this comment

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

"acq type"? jobID? Might be worth a note about what these are.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, added.

phuInfo['ccd'] = sensorLocationInRaft
phuInfo['raftId'] = raftId # also in the header - RAFTNAME
phuInfo['field'] = acquisitionType # NOT in the header
phuInfo['jobId'] = int(jobId) # NOT in the header, but do we need it?

Choose a reason for hiding this comment

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

Have you determined whether we need the "do we need it"s? If we don't, drop them, if you have reason to believe they'll be useful in the future, just remove the comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it might be useful to flag these so that I could check back in future to see if they were being used to de-cruft the registry, but perhaps you're right, and I should just de-cruft the code now. Removed 👍

Typically the position is within 0.005nm of the desired position, so we warn if it's not very
close to an integer value.

Future users should be aware that the HIERARCH MONOCH-WAVELENG key is NOT the requested value, and

Choose a reason for hiding this comment

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

Useful comment: glad you documented it.

wl = int(round(raw_wl))
if abs(raw_wl-wl)>=0.1:
logger = lsstLog.Log.getLogger('obs.comCam.ingest')
logger.warn('Translated signigicatly non-integer wavelength %s', raw_wl)

Choose a reason for hiding this comment

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

"significantly"

Is a log warning enough if it's not an int? Should it raise instead? What happens downstream?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm guessing your "significantly" comment is an objection to the lack of precision, given that they're ~always going to be non-integer to some extent. I've changed that to a more quantitative statement, using the 0.1nm constant that I'm testing against. Let me know if that's not what you wanted to imply.

For the warning, I think that's the right thing to do. The value is not necessarily wrong, and if downstream it turns into garbage then you want to just see a warning and what goes wrong, rather than it raising at the time.

Choose a reason for hiding this comment

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

I'm guessing his "significantly" comment is related to "signigicatly" not being a word. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lol, good point, thanks John! The (other) all-seeing eye strikes again! I've still changed the comment to something more rigorous though 🙂

@@ -84,7 +85,7 @@ def translate_wavelength(self, md):
wl = int(round(raw_wl))
if abs(raw_wl-wl)>=0.1:
logger = lsstLog.Log.getLogger('obs.comCam.ingest')
logger.warn('Translated signigicatly non-integer wavelength %s', raw_wl)
logger.warn('Translated overly non-integer wavelength; %s is more than 0.1nm from an integer value', raw_wl)

Choose a reason for hiding this comment

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

"Overly" is overly worse, I think. "significantly" (spelled correctly) is fine, particularly with the latter added comment.

The commit includes fixes to:
	Fix retargetting of task.
	Change ccd datatype from int to text
	Add wavelength translator and fix up the ingest
	Add config files for calib construction
	Add ccd number to template for calibs
	Add call to makeRawVisitInfo.getDarkTime() for getting the darkTime correctly
	Remove errant .gz suffixes from the policy file
@mfisherlevine mfisherlevine merged commit b330c95 into master Aug 1, 2017
@ktlim ktlim deleted the tickets/DM-9872 branch August 25, 2018 06:15
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