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-39604: Record full noise matrix in PTC dataset #269

Merged
merged 4 commits into from Jun 15, 2023
Merged

Conversation

plazas
Copy link
Contributor

@plazas plazas commented Jun 13, 2023

No description provided.

@plazas plazas requested a review from erykoff June 13, 2023 16:34
Copy link
Contributor

@erykoff erykoff left a comment

Choose a reason for hiding this comment

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

A small comment on the version checking to make it forward-compatible.

@@ -569,6 +597,13 @@ def fromTable(cls, tableList):
inDict['histVars'][ampName] = record['HIST_VARS']
inDict['histChi2Dofs'][ampName] = record['HIST_CHI2_DOFS']
inDict['kspValues'][ampName] = record['KS_PVALUES']
if calibVersion == 1.3:
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be calibVersion >= 1.3. And I realized that above it should be if calibVersion < 1.2. Or perhaps for better parallelism, this new code should be reversed, and calibVersion < 1.3 should be checked to set to nans, and else is to use the noise matrix.

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 just changed to calibVersion >= 1.3 and if calibVersion < 1.2, as you suggest. And the docstring was missing the comment for v1.2; I added "Version 1.2 adds the histVars, histChi2Dofs, and kspValues
attributes.". Please let me know if this is OK.

@plazas plazas requested a review from erykoff June 14, 2023 20:13
else:
nanMatrix = np.full_like(inDict['aMatrix'][ampName], np.nan)
inDict['noiseMatrix'][ampName] = nanMatrix
inDict['noiseMatrixNoB'][ampName] = nanMatrix
Copy link
Contributor

@erykoff erykoff Jun 14, 2023

Choose a reason for hiding this comment

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

I know this is a small thing, but I think that it would be better if we used the same construction for both calibVersion checks. Something like this:

            if calibVersion < 1.2:
                inDict['histVars'][ampName] = np.array([np.nan])
                inDict['histChi2Dofs'][ampName] = np.array([np.nan])
                inDict['kspValues'][ampName] = np.array([0.0])
            else:
                inDict['histVars'][ampName] = record['HIST_VARS']
                inDict['histChi2Dofs'][ampName] = record['HIST_CHI2_DOFS']
                inDict['kspValues'][ampName] = record['KS_PVALUES']
            if calibVersion < 1.3:
                nanMatrix = np.full_like(inDict['aMatrix'][ampName], np.nan)
                inDict['noiseMatrix'][ampName] = nanMatrix
                inDict['noiseMatrixNoB'][ampName] = nanMatrix
            else:
                inDict['noiseMatrix'][ampName] = record['NOISE_MATRIX']
                inDict['noiseMatrixNoB'][ampName] = record['NOISE_MATRIX_NO_B']

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I changed it to this. Thanks.

Copy link
Contributor

@erykoff erykoff left a comment

Choose a reason for hiding this comment

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

Small comment just to make things more readable, but otherwise looks good.

Slightly rearange logic in dataset
@plazas plazas merged commit d25bd44 into main Jun 15, 2023
1 check passed
@plazas plazas deleted the tickets/DM-39604 branch June 15, 2023 18:50
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