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

Spectrum of properties as a function of wavelength #141

Open
NicoTuccori opened this issue Jun 28, 2024 · 1 comment
Open

Spectrum of properties as a function of wavelength #141

NicoTuccori opened this issue Jun 28, 2024 · 1 comment

Comments

@NicoTuccori
Copy link

When defining the emission spectrum (or re-emission in the case of WLS materials) as a function of the wavelength, Ratpac uses the spectrum defined in the RATDB file, but it converts the wavelength to energy. This approach does not accurately reproduce the property, which is defined as a function of the wavelength in the database.
To correctly define the property as a function of wavelength, which is then used as a function of energy, it is necessary to normalise the spectrum by the square of the wavelength. This requirement can make the definition of this type of property confusing and prone to errors.
Ideally, Ratpac should handle the conversion of the spectrum from being a function of wavelength to a function of energy.

PropertiesWavelength.pdf

@gmwendel
Copy link
Collaborator

gmwendel commented Sep 9, 2024

Feature Proposal: Streamlining [MaterialProperty]_option Units Handling

The current implementation of the [MaterialProperty]_option key in ratdb allows for specifying options energy, wavelength, and dy_dwavelength. However, this approach adds unnecessary complexity to how users configure optical properties in RAT software, when dealing with material properties and emission spectra.

From the code, we see that the LoadProperty function handles transformations when data is provided as a function of wavelength, including a Jacobian transformation to energy when the dy_dwavelength option is specified. This transformation is required when the user inputs data as a probability density function (PDF) that needs to be converted from wavelength to energy. However, this explicit user-level control introduces potential for errors and confusion.

I propose that the [MaterialProperty]_option should be simplified to only define the units in which the data is provided (i.e., energy or wavelength). The decision to apply a Jacobian transformation should be made internally, based on whether the data represents a probability density function (PDF) or a deterministic material property. Specifically:

  • Deterministic material properties, such as optical photon absorption length, are continuous functions of wavelength and do not require an additional Jacobian transformation.

  • Probability density functions, such as the scintillation emission spectrum, describe stochastic processes and require a Jacobian transformation when converting from wavelength to energy to preserve the measure when changing between energy and wavelength.

There should never be a case where a specific [MaterialProperty]_option could be either a PDF or deterministic property. By making the transformation implicit in the type of parameter, the software can reduce the risk of misconfigurations, improve code clarity, and simplify the user experience. The software already distinguishes between these cases but would need to be rewritten to automate this process.

This would lead to a more intuitive and error-resistant system, ensuring that users only need to specify the units of their data, while the software handles the transformations automatically where appropriate.

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 a pull request may close this issue.

2 participants