Add YAML validator; sync allow-lists with METIS_Pipeline classification#181
Add YAML validator; sync allow-lists with METIS_Pipeline classification#181astronomyk wants to merge 4 commits into
Conversation
Scans YAML/ recursively, checks each file parses with PyYAML and is accepted by runSimulationBlock (with simulate stubbed out), and writes a markdown report identifying the offending top-level entries in any file that fails. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extracts validateYAML's checks into a standalone validate_recipes(rcps) -> list[str] function in runRecipes. The previous validateYAML exited early inside its first for-loop, so the filter/ND/catg/tech/type/mode/positivity checks never ran; they do now. validateYAML is a thin wrapper that prints each message. validate_yamls.py now calls validate_recipes as a static-validation step between PyYAML parse and runSimulationBlock acceptance. The markdown report gains a third category and files must clear all three to count as passing. metis_simulations.raw_script is also stubbed so importing runRecipes doesn't pull in ScopeSim at validator startup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sync catgVals / techVals / typeVals / modeVals / validFilters / validND in simulationDefinitions.py with the canonical DPR.CATG / .TECH / .TYPE values declared in METIS_Pipeline's metis_classification.py. Fixes: - techVals: PUP,M typo -> PUP,LM; add IFU (pipeline canonical form) - typeVals: add DARK, FLAT,TWILIGHT, FLAT,LAMP,PINH, RSRF, PERSISTENCE - modeVals: de-dup lss_m, add all wcu_* ScopeSim modes - validND: add ND-2.8 - validFilters: add wcu_* entries; widen LSS lists to include the matching-band imaging filters (shared filter wheel; used by AIT transmission sweeps) Renames the stray DARK,WCU_OFF (underscore) occurrences in six YAML files to DARK,WCUOFF to match classification. Static-validation failures drop from 65 to 7; remaining 7 are genuine YAML bugs (missing nObs/filter_name, indentation error under source:). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ation # Conflicts: # YAML/ESO/wcuOffIFU.yaml # YAML/ESO/wcuOffLM.yaml # YAML/ESO/wcuOffN.yaml
| @@ -0,0 +1,1023 @@ | |||
| # YAML validation report | |||
|
|
|||
| - YAML root: `D:\Repos\METIS_Simulations\YAML` | |||
There was a problem hiding this comment.
Please do not include code specific to your machine in the repository. This makes the report non-deterministic, meaning that everyone else would get a dirty repository when they run the validation script.
Also, why do we need this file at all in the repoitory if it can be generated?
| # DPR.CATG / .TYPE / .TECH values below follow the pipeline classification | ||
| # rules in METIS_Pipeline/metisp/workflows/metis/metis_classification.py, | ||
| # which is the authoritative source. A few extensions are kept for YAML |
There was a problem hiding this comment.
Now you are only rewriting what is already there, and this got better so this comment should not be a blocker, but still: why not import the canonical source directly?
I know one reason why, because the workflow directory of the pipeline is currently not in the pymetis package. But then please go and fix that, instead of propagating hacks.
|
Great for making these! However, the problem is not the availability of these scripts, but that people simply ignore them. I've created https://github.com/AstarVienna/METIS_Simulations/blob/main/metis_simulations/compare_yaml_with_drld.py that is subsequently only maintained and ran by me. So a bigger problem is that many people don't seem to care about such consistency at all. Most of us could write such a validator script, especially with help of Claude. But it seems I'm the only one doing so. Therefore, I think you would be of bigger service to the group by putting on your manager head and make the team care about the importance of such validators. Then we can (have the clanker) write them ourselves. Edit: we obviously do care about consistency, but we don't care enough to actually ensure consistency. |
|
I appreciate the sentiment and duly noted.
This script and the report are purely out of necessity for now. When I was
playing around with my AIT-hat on, I hit a bunch of yamls that didn't work
and I needed a quick way to test them.
Fwiw, I've also started a branch that tries to transfer the FITS header
setting over to the IRDB/Scopesim. All in the name of consistency.
Just a note on the large context here:
I think we all agree that METIS_Simulations was originally never meant as
production-ready code for a wider audience, and as such we never put the
same amount of emphasis on the design and development. But now that we are
actually offering it to the AIT team, it warrants a deeper look and some
refactoring effort to make it a more sustainable effort. This is a summer
project though, as there's too many other things to do atm.
…-------------------------------------
Kieran Leschinski
Department of Astrophysics
University of Vienna
Hugo Buddelmeijer ***@***.***> schrieb am Sa., 18. Apr. 2026,
09:50:
*hugobuddel* left a comment (AstarVienna/METIS_Simulations#181)
<#181?email_source=notifications&email_token=ACH66QWEQBP7NADIYFDQK7T4WMXTPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMRXGMYTMNZVGE4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2LK4DSL5RW63LNMVXHIX3POBSW4X3DNRUWG2Y#issuecomment-4273167518>
Great for making these!
However, the problem is not the availability of these scripts, but that
people simply ignore them.
I've created
https://github.com/AstarVienna/METIS_Simulations/blob/main/metis_simulations/compare_yaml_with_drld.py
that is subsequently only maintained and ran by me.
So a bigger problem is that many people don't seem to care about such
consistency at all. Most of us could write such a validator script,
especially with help of Claude. But it seems I'm the only one doing so.
Therefore, I think you would be of bigger service to the group by putting
on your manager head and make the team care about the importance of such
validators. Then we can (have the clanker) write them ourselves.
—
Reply to this email directly, view it on GitHub
<#181?email_source=notifications&email_token=ACH66QWEQBP7NADIYFDQK7T4WMXTPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMRXGMYTMNZVGE4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2LK4DSL5RW63LNMVXHIX3POBSW4X3DNRUWG2Y#issuecomment-4273167518>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACH66QXKPTQYL6BEHRHAOHT4WMXTPAVCNFSM6AAAAACX45X4O2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DENZTGE3DONJRHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Did I create the repository? I think so, since the first commit is mine. It was my goal to have different sets of simulations in here from the beginning. Basically a shared set of 'this is interesting data for METIS', as a consortium-wide collaboration. That's why initially there were different directories for different categories, and I'm happy these directories are back! I'm fine with how the repository developed; because the people that do the actual work should have the freedom to do it the way they feel comfortable. And the repository is shaping up nicely with the recent developments! Having yet another validator script does not add too much value I think; in fact, it adds negative value if the script is not ran or maintained. The existing YAML validation script is broken and thus adds only noise. I'll be happy to be proven wrong though. |
Summary
YAML/validate_yamls.py— scans every YAML underYAML/, checks (1) PyYAML parseability, (2) static validation viametis_simulations.runRecipes.validate_recipes, (3) acceptance byrunSimulationBlock(withsimulatestubbed). Writes a per-file markdown report toYAML/yaml_validation_report.md.runRecipes.validateYAMLinto a reusable module-levelvalidate_recipes(rcps) -> list[str]; fix the early-return bug on line 204 that was silencing the filter/catg/tech/type/nObs/ndit/dit checks.simulationDefinitions.pyallow-lists with the canonical DPR.CATG/.TECH/.TYPE values fromMETIS_Pipeline/metisp/workflows/metis/metis_classification.py(treated as authoritative): fixPUP,M→PUP,LM; addIFU; addDARK,FLAT,TWILIGHT,FLAT,LAMP,PINH,RSRF,PERSISTENCE; de-duplss_m; add allwcu_*modes; addND-2.8; widen LSS filter lists to include matching-band imaging filters (shared filter wheel).DARK,WCU_OFF→DARK,WCUOFFintestYAML.yamlto match the classification form (the threewcuOff*.yamlfiles were already corrected by thekl/yaml_wcoOff_hotfixon main and merged in here).After these changes the validator report goes from 14 passing / 65 static failures to 66 passing / 5 static failures. The remaining 5 static failures are genuine YAML bugs for the authors to address (missing
filter_nameincalib.yaml::IFU_DISTORTION_RAW, emptychophomeN.yaml, etc.).Test plan
python YAML/validate_yamls.pyruns clean and producesYAML/yaml_validation_report.md.Passing fileslist; a file only appears in Passing when it clears all three checks.from metis_simulations.runRecipes import validate_recipesworks without ScopeSim/IRDB installed (the validator pre-stubsscopesimWrapperandraw_script).runRecipes.validateYAML(...)callers still work — it's a thin wrapper overvalidate_recipes.🤖 Generated with Claude Code