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

Update sim.config_dict when saving a Simulation to a file #435

Open
fhagemann opened this issue Nov 18, 2024 · 0 comments
Open

Update sim.config_dict when saving a Simulation to a file #435

fhagemann opened this issue Nov 18, 2024 · 0 comments
Labels
convenience Improve user-friendliness enhancement Improvement of existing features good first issue Good for newcomers

Comments

@fhagemann
Copy link
Collaborator

fhagemann commented Nov 18, 2024

A Simulation is usually created from a config_dict, which is saved under sim.config_dict.
However, when properties of a Simulation are changed within the code, e.g.

sim.detector = SolidStateDetector(sim.detector, ADLChargeDriftModel())
sim.detector = SolidStateDetector(sim.detector, BoggsChargeTrappingModel())
sim.detector = SolidStateDetector(sim.detector, contact_id = 1, contact_potential = 4000u"V")
sim.detector = SolidStateDetector(sim.detector, ConstantImpurityDensity(-1e15))

this is not updated in the sim.config_dict.

This is, in general, not a big issue. However, when saving a Simulation to an LH5 file and reading it back in, the SolidStateDetector will be constructed from the sim.config_dict and will have forgotten about the settings set interactively.

How I envision this:
When saving, we could add a check which constructs a new Simulation from the current sim.config_dict.
It, then, compares all initial fields of the new Simulation (excluding e.g. electric_potential, electric_field, weighting_potentials, ... which may or may not have been calculated) to the existing ones. If there is a mismatch, it should update the sim.config_dict accordingly, before saving it to a file.

Up for discussion would be whether such a config_dict up-to-date test should be optional or not.
And if so, whether it should be on by default or not.

@fhagemann fhagemann added enhancement Improvement of existing features good first issue Good for newcomers convenience Improve user-friendliness labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
convenience Improve user-friendliness enhancement Improvement of existing features good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant