Add confirm_recomp option to IsochronePhot; fix PYSYN_CDBS import-time lookup - #163
Open
wei-lingfeng wants to merge 3 commits into
Open
Add confirm_recomp option to IsochronePhot; fix PYSYN_CDBS import-time lookup#163wei-lingfeng wants to merge 3 commits into
wei-lingfeng wants to merge 3 commits into
Conversation
IsochronePhot already prompted before regenerating an isochrone file whenever verbose=True, accepting only the exact string "yes" and returning on anything else. Put that prompt behind a new confirm_recomp argument, and loop on invalid input instead of silently cancelling. Also documents confirm_recomp and the existing verbose argument, and splits the long __init__ signature over one argument group per line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Whitespace only, no functional change. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
rebin_BTSettl_2015 and rebin_WDKoester read os.environ['PYSYN_CDBS'] in their default arguments, which Python evaluates when the module is imported. Importing spisea.atmospheres therefore raised KeyError on any machine where PYSYN_CDBS was not set, even for code that never calls these two functions. Move the lookup into the function bodies behind a None default. Callers that set PYSYN_CDBS see identical behaviour, and an explicit cdbs_path still overrides it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three small, independent changes, one per commit.
1.
confirm_recompoption forIsochronePhotIsochronePhot.__init__currently prompts before regenerating an isochrone file wheneververbose=True. It accepts only the exact string"yes"and returns on anything else, so a typo silently cancels the run.This puts the prompt behind a new
confirm_recompargument and loops on invalid input instead of cancelling.Please note this changes existing behaviour:
confirm_recompdefaults toFalse, so averbose=Truerun that prompts today will no longer prompt. That seemed right to us — the prompt makes an otherwise scriptable call block on stdin — but happy to default it toTrueinstead if you'd rather preserve the current behaviour.Also documents
confirm_recompand the pre-existingverboseargument, and splits the long__init__signature across lines.2. Remove trailing whitespace in
synthetic.pyWhitespace only.
git diff --ignore-space-at-eolon this commit is empty. Split out so it doesn't obscure the change above; drop it if you'd prefer to keep it out.3. Resolve
PYSYN_CDBSat call time rather than import timerebin_BTSettl_2015andrebin_WDKoesterreados.environ['PYSYN_CDBS']in their default arguments, which Python evaluates when the module is imported. Soimport spisea.atmospheresraisesKeyError: 'PYSYN_CDBS'on any machine where that variable is not set, even for code that never calls either function:Moving the lookup into the function bodies behind a
Nonedefault fixes it. Callers withPYSYN_CDBSset see identical behaviour, and an explicitcdbs_pathstill overrides. The otherPYSYN_CDBSreferences in the file are inside function bodies and were already fine.Related: the API docs for
syntheticare currently blank on RTDWhile tracking the above down we noticed that every
synthetic.*class section on Read the Docs renders as an empty heading — make_isochrone and make_cluster — whileimfandevolutionrender fine.autodoccannot importsyntheticin the RTD build, and there are three sequential import-time blockers:atmospheres.pyPYSYN_CDBSin default args — fixed by this PRsynthetic.py:42default_evo_model = evolution.MISTv1()— requires theMISTv1/v1.2-synthpop/directory to existsynthetic.py:68vega = Vega()— readscdbs/grid/k93models/catalog.fitsSo this PR clears only the first. 2 and 3 need the model data at import time, which the RTD builder will not have. We didn't attempt those here since making the module importable without data is a design decision for you — happy to open a separate issue with the details if that's useful.
🤖 Generated with Claude Code