-
Notifications
You must be signed in to change notification settings - Fork 50
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
Addition of density as a free parameter for tomography #764
Conversation
"Merging changes from upstream/master to update my fork."
Conflicts: pisa/stages/osc/prob3.py pisa/stages/osc/prob3numba/numba_osc_tests.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to modify the Layers class to be able to deal with density scale changes rather than to do everything in the osc stage and reinitialize the class every time
pisa/stages/osc/prob3.py
Outdated
if self.neutrino_decay: | ||
self.decay_params.decay_alpha3 = self.params.decay_alpha3.value.m_as('eV**2') | ||
|
||
if self.lri_type is not None: | ||
self.lri_params.v_lri = self.params.v_lri.value.m_as('eV') | ||
if self.tomography_type == "mass_of_earth": | ||
self.tomography_params.density_scale = self.params.density_scale.value.m_as('dimensionless') | ||
self.layers = Layers(earth_model, detector_depth, prop_height,scaling_array=self.tomography_params.density_scale) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to give the Layers
class something like a scale function that you can call here to not initialize the class every time the stage is called. That would simplify the entire code (not only this part) and should be faster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Jan, I have made the modifications. Instead of calling Layers
class everytime, now I am calling the scaling function. The scaling function multiplies the scaling factors with the density array. In prob3.py
I update the physics parameters (density_scale
for mass of Earth, core_density_scale
for mass of core (with constrain), etc). Then I call the scaling function from Layers
class, where the scaling is done. In this way, the density array is scaled depending on the type of tomography.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better now. It might be even simpler to just multiply container['densities'] with the scaling array (and store an unscaled version of container['densities'] somewhere), but this also works.
pisa/stages/osc/prob3.py
Outdated
for container in self.data: | ||
self.layers.calcLayers(container['true_coszen']) | ||
container['densities'] = self.layers.density.reshape((container.size, self.layers.max_layers)) | ||
container['distances'] = self.layers.distance.reshape((container.size, self.layers.max_layers)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you also have to overwrite this? The scaling shouldn't change the distances, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes right. We don't need to overwrite container['distances']. I have removed it. We only require till container['densities'].
Addition of density as a free parameter for tomography
Sharmistha Chattopadhyay
Modified
prob3.py
tomography_type
tomography_type
- [mass of earth, mass of core (with constrain), mass of core (without constrain)density_scale
core_density_scale
Introduced
scaling_params.py
Modified
layers.py
Modified
numba_osc_tests.py