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

Collate1D input file Parameter Names #1811

Open
woodml opened this issue May 22, 2024 · 2 comments
Open

Collate1D input file Parameter Names #1811

woodml opened this issue May 22, 2024 · 2 comments
Assignees

Comments

@woodml
Copy link
Contributor

woodml commented May 22, 2024

There is discrepancy between the listed parameter names and the parameter names accepted by the Collate1D script, leading to a raised ValueError.

I think there are two related problems here (not sure that they require different issues), one with the documentation and examples on the parameter --exclude_slit_bm, and another with the code for the parameter --chk_version.

Problem 1: exclude_slit_bm
This parameter is referred to with three different names in the documentation. It also has a different name depending on if you set it in an input file or via command line.
For command line the parameter name is --exclude_slit_bm, while for an input file the name that works is exclude_slit_trace_bm. However, the example input file uses slit_exlude_flags.

To solve this I think the documentation example input file should be updated to match the current syntax, and possibly the code should be changed so that the input file and the command line usages use the same parameter names.

Problem 2: chk_version
When using the input file to run Collate1D a ValueError will be raised if chk_version is provided as a parameter.

Error message:

File "~/anaconda3/envs/pypeit/lib/python3.11/site-packages/pypeit/par/pypeitpar.py", line 5299, in from_dict
    raise ValueError('{0} not recognized key(s) for Collate1DPar.'.format(k[badkeys]))
ValueError: ['chk_version'] not recognized key(s) for Collate1DPar.

To fix this chk_version needs to be added to the list of parameter keys on lines 5293-5295 of pypeit/par/pypeitpar.py.

The relevant code:

   5291     def from_dict(cls, cfg):
   5292         k = [*cfg.keys()]
   5293         parkeys = ['tolerance', 'dry_run', 'ignore_flux', 'flux', 'match_using',
   5294                    'exclude_slit_trace_bm', 'exclude_serendip', 'outdir', 'spec1d_outdir',
   5295                    'wv_rms_thresh', 'refframe']
   5296 
   5297         badkeys = np.array([pk not in parkeys for pk in k])
   5298         if np.any(badkeys):
   5299             raise ValueError('{0} not recognized key(s) for Collate1DPar.'.format(k[badkeys]))

(Note: the ValueError is not actually raised on the current branch, due to an Type Error with the line to raise the error, I suggested a fix for that in a separate pull request)

@badpandabear
Copy link
Collaborator

I had always intended the command line to use an abbreviated version of the options to save typing, but perhaps that is a mistake that causes more confusion that it's worth. I'll have to think on that.

But there are definitely some documentation bugs in the problems listed above.

Problem 1:
The example input file needs to be updated with the current name for exclude_slit_trace_bm

Problem 2:
It was decided to move chk_version out of the collate1d params and to use the version in the rdx params. So to specify it in the collate1d input file the user has to add a [rdx] section. But the documentation doesn't reflect this change.

I plan to fix these issues in #1814

@badpandabear
Copy link
Collaborator

Oops this fix didn't make it into PR#1814

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

No branches or pull requests

2 participants