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-23681: Check, in the unit tests, that fitPtcAndNonLinearity returns what it is supposed to return. #27

Merged
merged 7 commits into from Mar 30, 2020

Conversation

plazas
Copy link
Contributor

@plazas plazas commented Mar 16, 2020

No description provided.

@plazas plazas requested a review from jdswinbank March 16, 2020 22:44
@@ -95,50 +99,94 @@ def setUp(self):
self.dataset.rawExpTimes[ampName] = timeVec
self.dataset.rawMeans[ampName] = muVec

def test_ptcFitQuad(self):
def ptcFitQuadAndCubic(self, order):
Copy link
Contributor

Choose a reason for hiding this comment

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

If you have to specify the order, it's not really QuadAndCubic but QuadOrCubic, right? :-)

More generally, I think I'd just call this fitAndCheckPtc or similar, rather than trying to specify the order of fitting in the function name.

for ampName in self.ampNames:
localDataset.rawVars[ampName] = [self.noiseSq + self.c1*mu + self.c2*mu**2 + self.c3*mu**3 for
mu in localDataset.rawMeans[ampName]]
self.assertAlmostEqual('POLYNOMIAL', returnedDataset.ptcFitType[ampName])
Copy link
Contributor

Choose a reason for hiding this comment

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

This has to be exactly equal, right? I'm not even sure what “almost equal” means for a string.

self.assertTrue(localDataset.nonLinearityResiduals[ampName].all() == 0)
def test_ptcFitQuadAndCubic(self):
for order in [2, 3]:
self.ptcFitQuadAndCubic(order)

def test_ptcFitAstier(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Almost all of the changes in this function are a duplicate of those in ptcFitQuadAndCubic. Could you take this opportunity to combine them into one? It'd be a lot easier to see what was going on, and to make sure they are updated in sync in future!

@plazas plazas merged commit a90c110 into master Mar 30, 2020
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