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-7292: Port to Python 3 #77

Merged
merged 15 commits into from Nov 4, 2016
Merged

DM-7292: Port to Python 3 #77

merged 15 commits into from Nov 4, 2016

Conversation

fred3m
Copy link
Contributor

@fred3m fred3m commented Sep 15, 2016

No description provided.

@timj timj changed the title Run autopep8 DM-7292: Port to Python 3 Sep 15, 2016
@@ -183,9 +184,12 @@ def assertCatalogsEqual(self, catalog1, catalog2, skipCols=()):
self.assertEqual(catalog1.schema, catalog2.schema)
self.assertEqual(len(catalog1), len(catalog2))
d = catalog1.schema.extract("*")
def fixNaN(x):
if x!=x:
return "NaN"
fixNaN = lambda x: x if x == x else "NaN"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this lambda be removed with the introduction of the fixNaN function?

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, I think I was in the middle of making this change when something interrupted me and since it didn't break anything I must have forgotten about it. Great catch.

simSrcRecord.setL(self.objectIdKey, truthRecord.getId())
simSrcRecord.setL(self.exposureIdKey, obsRecord.getId())
simSrcRecord.setI(self.objectIdKey, truthRecord.getId())
simSrcRecord.setI(self.exposureIdKey, obsRecord.getId())
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you verified that integers can hold the values we use, and won't be too short?

Copy link
Member

Choose a reason for hiding this comment

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

There is much confusion over L vs I in the C++ interface layer. Python (2 or 3) both use at least 64-bits for normal int type but in most cases C++ treats I as a 32-bit integer and that would indeed be too short for our 64-bit IDs.

See the discussion on RFC-227.

self.assertAlmostEqual(bgMean, 191.51595080958367, places=7)
self.assertAlmostEqual(bgStdDev, 0.22492169148323429, places=7)
self.assertAlmostEqual(bgMean, 191.51595080958367, places=3)
self.assertAlmostEqual(bgStdDev, 0.22492169148323429, places=3)
Copy link
Contributor

Choose a reason for hiding this comment

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

7 places to 3 places is a huge change! Do differences in software stacks really produce different numbers at the 10^-(3/4) level? If so that is worrying. It implies we might have reproducibility issues in the future. Is this test able to be tightened up to ~5? What are the magnitude of differences we are seeing between versions? Is this related to changing to ints places? Are we losing precision in calculations? I know these are kind of big questions to ask, but making changes to unit tests to make things work scares me unless we can really justify why the change is nessisary.

# The values asserted here are the precise result that py2 gives. The precision below
# should be tightened and this comment removed in the course of DM-8017.
# Also see: https://community.lsst.org/t/difference-in-py2-and-py3-background-models/1240

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess disregard the past comment as I got to this last. As there is a ticket to do this work, I see no need to do the work on this ticket.

fred3m and others added 14 commits October 31, 2016 12:02
In python 3 longs are not recognized, so it is necessary to use int's instead of longs
and setI/getI methods.
The tests were updated in DM-6815 due to changes in the config parameters but the old tolerances
were too tight. Slight differences in compilers and (apparently) python versions causes much larger
variations than the old tests allow. See 3f8730a for more.
@mrawls mrawls force-pushed the tickets/DM-7292 branch 3 times, most recently from 9ce9bd3 to 3fda82b Compare November 4, 2016 03:10
Delete "from builtins import str" rather than just comment out
@mrawls mrawls merged commit 13b48c0 into master Nov 4, 2016
@ktlim ktlim deleted the tickets/DM-7292 branch August 25, 2018 06:46
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

5 participants