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

Handling of negative spec_step and spec_linewidth #15

Open
patrick-austin opened this issue May 31, 2024 · 3 comments
Open

Handling of negative spec_step and spec_linewidth #15

patrick-austin opened this issue May 31, 2024 · 3 comments

Comments

@patrick-austin
Copy link
Contributor

Describe the bug
Submitting a negative spec_step results in the command never completing.
Submitting a negative spec_linewidth results in a completing job, but don't think that a negative width is physically valid.

To Reproduce

element: Au
isotope: -1
xr_lines: K1:L3-K1:L3
uehling_correction: false
nuclear_model: POINT
output: 1
write_spec: true
spec_step: -10000.0
spec_linewidth: 100000.0
element: Au
isotope: -1
xr_lines: K1:L3-K1:L3
uehling_correction: false
nuclear_model: POINT
output: 1
write_spec: true
spec_step: 10000.0
spec_linewidth: -100000.0

Expected behavior
The former should definitely not be allowed. A validation error should prevent a negative step being used to prevent the command never completing.
I also don't think that a negative linewidth is physically valid, but this is less of an issue as it doesn't cause a total failure like the step does.

Screenshots
Spectrum with 1e5 linewidth
image

Spectrum with -1e5 linewidth
image

DesktopVM (please complete the following information):

  • OS: Rocky
  • Version 8
@leandro-liborio
Copy link
Contributor

Hi both,

Good point Patrick. None of those negative values should be allowed, as they do not have any physical meaning.

@patrick-austin
Copy link
Contributor Author

Other parameters that can cause issues when given negative values:

  • uehling_steps: leads to bad allocation and the core being dumped when <0
  • uehling_lowcut
  • uehling_highcut: (presumably should also need to be greater than uehling_lowcut)
  • max_E_iter
  • max_nodes_iter
  • max_state_iter

At this point I think it's likely that a lack of input validation is the rule rather than the exception. A general review of all numeric parameters to ensure they are being validated is probably sensible.

@leandro-liborio
Copy link
Contributor

with regards to spec-step and spec-line-width being negative. We now have a message when a negative value is used. It is this one: ' Parameter spec_step: Value ('-10.0') must fulfill float('0.0') <= float(value) <= float('inf')'. Now... I understand that error message. It says that the values has to be between 0 and inf. However... Is there any way of putting this error message in human-like language?

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