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

port obs_decam to python3 Tickets/dm 7307 #37

Merged
merged 4 commits into from Nov 10, 2016
Merged

Conversation

parejkoj
Copy link
Contributor

@parejkoj parejkoj commented Nov 8, 2016

No description provided.

Copy link
Contributor

@mrawls mrawls left a comment

Choose a reason for hiding this comment

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

Goodness, there were so many changes in camera.py that GitHub can't display it? Fun. Was that just a bunch of PEP 8 stuff too, or something more substantial?

Edit... I realized I can answer my own question by looking at each individual commit... and it is all PEP 8 updates to a laundry list of manually incremented values, so I'm confident it's fine.

if tract < 0 or tract >= 2**DecamMapper._nbit_tract:
raise RuntimeError('tract not in range [0,%d)' % (2**DecamMapper._nbit_tract))
patchX, patchY = map(int, dataId['patch'].split(','))
patchX, patchY = [int(x) for x in dataId['patch'].split(',')]
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming these are indeed equivalent, I learned a thing about map and list comprehensions today, thanks!

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, map functionality can be done with list comprehensions, and it's usually easier to read. There was once a speed difference (circa python 2.4), but that's no longer the case.

@@ -1,3 +1,4 @@
from __future__ import absolute_import, division, print_function
Copy link
Contributor

Choose a reason for hiding this comment

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

It's clearer to have one import statement per line.

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 think the one exception we make to the "one import per line" is for future, since we generally want all three. @r-owen suggested always having that line in alphabetical order, to make for easier searching in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK fair enough!

@@ -58,6 +58,7 @@ def setUp(self):
"isr.assembleCcd.setGain=False",
# This test uses CP-MasterCal calibration products
"-C", "%s/processCcdCpIsr.py" % configPath]
argsList.append('--doraise')
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you clarify what this line is adding? Was testProcessCcd failing silently before in some situations?

Copy link
Contributor Author

@parejkoj parejkoj Nov 9, 2016

Choose a reason for hiding this comment

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

Good point! Should I clarify in the commit?

Your guess is almost correct: previously, ProcessCcdTask.parseAndRun was failing without raising an exception, and so the subsequent tests would fail because the files they expected were not created, and thus it was really unclear where the problem was.

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense. It wouldn't hurt to elaborate in the commit in case folks want an example of how to add clearer exceptions when troubleshooting mystery failures.

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've pushed an updated commit message, based on the above. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Thanks!

ProcessCcdTask.parseAndRun was failing without raising an exception, and so the
subsequent tests would fail because the files they expected were not created,
and thus it was really unclear where the problem was. Adding --doraise to the
arguments means the failure happens in setUp, so debugging is easier.
@parejkoj parejkoj merged commit 770a1f1 into master Nov 10, 2016
@ktlim ktlim deleted the tickets/DM-7307 branch August 25, 2018 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants