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

Historical SNAPInstPrm #540

Merged
merged 7 commits into from
Feb 19, 2025
Merged

Historical SNAPInstPrm #540

merged 7 commits into from
Feb 19, 2025

Conversation

walshmm
Copy link
Collaborator

@walshmm walshmm commented Jan 30, 2025

This PR also requires changes to snapred-data: https://code.ornl.gov/sns-hfir-scse/infrastructure/test-data/snapred-data/-/merge_requests/4

Description of work

This pr enables snapred to track and refer to historical/indexed SNAPInstPrm's by a run number conditional.
It also comes with a cis_test script for initializing said index.
NOTE: I recommend using said script to add the index to your local Calibration directory.

Explanation of work

  • UPDATED InstrumentConfig a VersionedObject so it can be indexed
  • UPDATED applies to logic to now support comma separated conditionals for multiple bounds.
  • UPDATED run number is now required when using EventNexus loaders in GroceryService/FetchGroceries due to the necessity of instrumentState values to removePromptPulse
  • UPDATED Indexer to funnel all saves and loads of indexed files to a shared set of central methods operating on VersionedObjects
  • UPDATED SousChef to always pull a new InstrumentState based on the the instrumentConfig in the new index, as per request of Malcolm
  • UPDATED test data to utilize new index

To test

Create a new SNAPInstPrm index using the cis_test script
Run all workflows to completion.

Ensure No Regression.

Link to EWM item

EWM#3408

Verification

  • the author has read the EWM story and acceptance critera
  • the reviewer has read the EWM story and acceptance criteria
  • the reviewer certifies the acceptance criteria below reflect the criteria in EWM

Acceptance Criteria

This list is for ease of reference, and does not replace reading the EWM story as part of the review. Verify this list matches the EWM story before reviewing.

  • 1. We need a naming scheme that allows for multiple instances of the SNAPInstPrm.json e.g. SNAPInstPrm_00.json, SNAPInstPrm_01.json etc.
  • 2. We need to add parameters: minimumApplicableRunNumber and maximumApplicableRunNumber (or similar range definition) such that there is an unambiguous indexing of input sample or calibrant run numbers with the resultant json files.
  • 3. SNAPRed must be able to acquire the correct InstPrm file on the basis of input run number
  • 4. The correct instPrm file will be applied for any of SNAPRed's workflows: difcal, normcal or reduction.
  • 5. Although we are currently envisaging only two InstPrm files to be needed. The design should allow for future InstPrm files to be created (although not more than a handful of these are expected)

Copy link

codecov bot commented Jan 30, 2025

Codecov Report

Attention: Patch coverage is 98.78049% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.08%. Comparing base (4b6648a) to head (1cadf01).
Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
src/snapred/backend/data/LocalDataService.py 95.83% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next     #540      +/-   ##
==========================================
+ Coverage   96.03%   96.08%   +0.04%     
==========================================
  Files          71       71              
  Lines        5454     5461       +7     
==========================================
+ Hits         5238     5247       +9     
+ Misses        216      214       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@walshmm walshmm changed the title refactor indexer to rounte saves and loads through a generic Versione… refactor indexer to route saves and loads through a generic Versione… Jan 31, 2025
@walshmm walshmm marked this pull request as ready for review February 5, 2025 21:43
@walshmm walshmm changed the title refactor indexer to route saves and loads through a generic Versione… Historical SNAPInstPrm Feb 6, 2025
@walshmm walshmm force-pushed the ewm3408_historical_instrument_config branch from e1d7918 to 8a3b695 Compare February 13, 2025 17:16
@walshmm
Copy link
Collaborator Author

walshmm commented Feb 17, 2025

@rboston628 I believe I have addressed all your comments, is there anything I missed?

rboston628
rboston628 previously approved these changes Feb 18, 2025
Copy link
Contributor

@rboston628 rboston628 left a comment

Choose a reason for hiding this comment

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

The use of Indexer, and the methods setup inside GroceryService, will ensure the correct set of instrument parameters is grabbed on a per-run basis. The attached script sets up the indexer folder, and I can confirm SNAPRed is pulling the correct params in all three workflows.

walshmm and others added 7 commits February 19, 2025 11:31
…dObject form of each method

integrate new lookup, passing tests

fix some tests, break others maybe

fixes from manual testing and script for initializing the new indexed snap inst prm

Cleanup some names

added some additional test coverage of new code

always pull new instrument state when writing new calibrations

fix tests

point at new data commit for changes

up coverage a bit

last bit of coverage?
@walshmm walshmm force-pushed the ewm3408_historical_instrument_config branch from 41ed407 to 1cadf01 Compare February 19, 2025 16:31
@walshmm walshmm merged commit 677c5b2 into next Feb 19, 2025
8 checks passed
@walshmm walshmm deleted the ewm3408_historical_instrument_config branch February 19, 2025 20: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.

2 participants