-
Notifications
You must be signed in to change notification settings - Fork 2
Ewm6834 fix default record #452
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
Conversation
3c10247
to
6973dbc
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #452 +/- ##
==========================================
+ Coverage 96.08% 96.11% +0.03%
==========================================
Files 61 61
Lines 4445 4483 +38
==========================================
+ Hits 4271 4309 +38
Misses 174 174 ☔ View full report in Codecov by Sentry. |
f97d9d1
to
0603a92
Compare
|
||
|
||
class CreateNormalizationRecordRequest(BaseModel, extra="forbid"): | ||
class CreateNormalizationRecordRequest(NormalizationRecord, extra="forbid"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do see the purpose of this, but the necessity for this extra layer struck me as a bit weird. That is, if this is basically just a NormalizationRecord
, then why do we need the additional request class. (For example, instead we could have Indexer.updateRecordVersions
, instead of Indexer.createRecord(<from this record??>)
which might be more clear, in terms of what is actually happening.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did think this data object was kinda odd, I didnt look too closely at it. Looking further into how its used there's a bit of a smell.
I think this had been just passing a record around up until the indexer stuff?
I'll see if I can rectify this.
@@ -222,11 +224,19 @@ def _createDiffcalDiagnosticWorkspaceFilename(self, item: GroceryListItem) -> st | |||
/ (self._createDiffcalOutputWorkspaceName(item) + ext) | |||
) | |||
|
|||
def _createDiffcalTableFilepathFromWsName( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this. I could do
runNumber, useLiteMode, version = wsName.tokens('runNumber', 'useLiteMode', 'version')
to get the required field values. What is the purpose of the redundant arguments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, and possibly more importantly, what happens when these argument values are in contradiction with each other?
@@ -842,7 +842,7 @@ def _writeDefaultDiffCalTable(self, runNumber: str, useLiteMode: bool): | |||
indexer = self.calibrationIndexer(runNumber, useLiteMode) | |||
version = indexer.defaultVersion() | |||
grocer = GroceryService() | |||
filename = Path(grocer._createDiffcalTableWorkspaceName("default", useLiteMode, version) + ".h5") | |||
filename = Path(grocer.createDiffcalTableWorkspaceName("default", useLiteMode, version) + ".h5") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get this: why does "default" subsume the <run number> position (especially as "default" as a string is not a legitimate <run number>), but not just use the VERSION_DEFAULT
which is provided for that reason particularly? (And then use the real <run number> which might be useful information. What am I missing here?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized later that possibly there's no meaningful <run number> where this is actually required. I would like to see these "default" names centralized somewhere (we have the same requirement for < version > ), but that doesn't have much to do with this PR.
@@ -199,7 +199,7 @@ def fetchCalibrationWorkspaces(self, item: Any) -> Dict[str, Any]: | |||
} | |||
|
|||
def fetchDefaultDiffCalTable(self, runNumber: str, useLiteMode: bool, version: int | Any) -> str: | |||
tableWorkspaceName = self._createDiffcalTableWorkspaceName("default", useLiteMode, version) | |||
tableWorkspaceName = self.createDiffcalTableWorkspaceName("default", useLiteMode, version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as mentioned previously: this name should possibly not be generated this way.
@@ -33,6 +33,7 @@ class NormalizationRecord(Record, extra="ignore"): | |||
workspaceNames: List[WorkspaceName] = [] | |||
calibrationVersionUsed: int = VERSION_DEFAULT | |||
crystalDBounds: Limit[float] | |||
normalizationCalibrantSamplePath: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm tempted to suggest, that because this is a NormalizationRecord
, the "normalization" part of normalizationCalibrantSamplePath
is redundant. And that to clarify the usage, the "normalization" only be added at the ReductionRecord.normalizationCalibrantSamplePath
. (However, I can go either way on this.)
tests/util/WhateversInTheFridge.py
Outdated
@@ -100,6 +100,7 @@ def readNormalizationRecord(self, runId: str, useLiteMode: bool, version: Option | |||
useLiteMode=useLiteMode, | |||
version=version, | |||
calculationParameters=self.calculationParameters_with_stateId("0xdeadbeef"), | |||
normalizatinoCalibrantSamplePath="path/to/calibrant", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misspelling of normalizationCalibrationSamplePath
(and also check it at the source in the NormalizationRecord
declaration).
fix default calibration use during reduction fix some tests fix the rest of the tests remove comment, no longer relevant
57046cd
to
cafe2e9
Compare
I tested reduction, following only state initialization (i.e. no calibration). Everything works as it should. The resulting Then I tested the calibration and normalization panels: in normalization save panel, there was a bug (as the new Performed a minor rebase, fixed the bug, and retested. Everything appears to be working as it should be. However Darsh will actually need to approve it, since I modified the code. |
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Reviewed and tested.
Description of work
This pr allows:
This needs a follow up to address when a state is totally uninitialized.
Explanation of work
I brought over some changes from
staging
for the calibrant sample stuff. These were actually somewhat essential when interacting with the default record, as it doesnt have a calibrant sample set (nor is it relevant to reduction).I updated
GroceryService
andIndexer
to account for the default record, adding a case to attempt to read on if no other record is available. Doing this, I also changed the way we pull diffcaltable names, and refer to the calibration record filtering on ws type--this simplified referring to the special name default tables recieve and allow me to avoid special logic in this case.To test
Initialize a new state.
run reduction
it should prompt you to continue anyway
see that it completes
this should apply the default calibration during reduction.
Link to EWM item
EWM#6834