-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add uc 08 derive simulation production configuration parameters #1098
Add uc 08 derive simulation production configuration parameters #1098
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Would like start the discussions how to best organize the code. At this point most of it is in the applications, but we want to move it into modules. Suggest to start a module to put those classes in. What would be a good name?
This module would include all classes currently defined in
@orelgueta , @tobiaskleiner : please comment. |
Not much for me to comment. This is the first time I see that those modules are in applications and I definitely agree they should go into simtools instead. In terms of which name to put them under, I would vote for |
I agree with the |
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
||
# Determine the effective area threshold (50% of max effective area) | ||
max_efficiency = np.max(efficiencies) | ||
threshold_efficiency = 0.1 * max_efficiency |
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.
The docstring says "exceeds 50%". Do you use actually 10%?
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
@GernotMaier thanks for the review. I went through the comments and adressed most of them. Few more points need discussion/implementation see #1233, #1227, #1219. Will let you know when I have fixed the unit tests for another review. |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
@GernotMaier thanks again for the review of the first part of the PR. Went through your comments and fixed the unit/integration tests. I factored out the event scaling logic and added a file for helper functions in the production configuration folder. In there we could also move the dl2 reading part in a later stage. |
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
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.
A couple of more comments on the production_generate_simulation_config
.
I will talk to you directly about a couple of points.
The data level for the simulation (e.g., 'A', 'B', 'C'). | ||
science_case (str, required) | ||
The science case for the simulation. | ||
file_path (str, required) |
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.
Suggest to change the file_path
doc string to
Path to file with MC events at CTAO DL2 data level. Used for statistical uncertainty evaluation.
elevation (float, required) | ||
Elevation angle in degrees. | ||
nsb (float, required) | ||
Night sky background value. |
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 the units for the NSB is "Hz" (but please check)
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.
Not 1/(srnscm**2) ?
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.
please find it out. I know that in some places we use Hz (which requires the knowledge of the pixel fov)
config.parser.add_argument( | ||
"--data_level", type=str, required=True, help="Data level (e.g., 'A', 'B', 'C')." | ||
) | ||
config.parser.add_argument( |
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.
Agree, added this to the list of discussions.
"--science_case", type=str, required=True, help="Science case for the simulation." | ||
) | ||
config.parser.add_argument( | ||
"--file_path", type=str, required=True, help="Path to the dl2_mc_events_file FITS file." |
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.
See comment above.
Path to MC event file in DL2 format
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.
Adding some comments here, but the changes are done in the separate part1 PR.
Changed the comment to your suggestion.
"--metrics_file", | ||
required=True, | ||
type=str, | ||
help="Path to YAML file containing metrics and required precision as values (required).", |
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 you can remove the (required)
from the comment (it is the only parameter with this added, although others are required).
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.
Done
max_error : float | ||
Maximum relative error. | ||
""" | ||
if "relative_errors" in self.metric_results["error_eff_area"]: |
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.
Trying to understand a case where relative_errors
is not in metric_results by error_eff_area
is filled. If I understand it correctly, both variables are always filled in calculate_metrics
?
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.
No currently this depends on the production_simulation_config_metrics
file and what metrics are given there (i.e. which metric computation is required).
) | ||
valid = (simulated_event_counts > 0 * u.ct) & (triggered_event_counts > 0 * u.ct) | ||
|
||
uncertainties = np.zeros_like(triggered_event_counts) * u.ct**-0.5 |
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.
Can you explain the '-0.5'?
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.
good point, this was wrongly implemented and the errors should be dimensionless. Previously when keeping the units the rel error turns out with this dimension.
|
||
return efficiencies, relative_errors | ||
|
||
def calculate_energy_threshold(self): |
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.
Suggest to replace the hardwired 10% by a variable (which default is 10%)
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.
added
bin_edges = np.concatenate([bin_edges_low, [bin_edges_high[-1]]]) | ||
return np.unique(bin_edges) | ||
|
||
def compute_histogram(self, event_energies_reco, bin_edges): |
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.
Suggest 'compute_triggered_event_histogram' to make the purpose of this function clearer.
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.
done
Parameters | ||
---------- | ||
event_energies_reco : array | ||
Array of energies of the observed events. |
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.
Array of reconstructed energy per event
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.
done
This comment has been minimized.
This comment has been minimized.
…UC-08-derive-simulation-production-configuration-parameters
This comment has been minimized.
This comment has been minimized.
…masim/simtools into add-UC-08-derive-simulation-production-configuration-parameters
This comment has been minimized.
This comment has been minimized.
…rameters' of https://github.com/gammasim/simtools into add-UC-08-derive-simulation-production-configuration-parameters
This reverts commit dd2cc81.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…UC-08-derive-simulation-production-configuration-parameters
This comment has been minimized.
This comment has been minimized.
…UC-08-derive-simulation-production-configuration-parameters
Analysis Details0 IssuesCoverage and DuplicationsProject ID: gammasim_simtools_AY_ssha9WiFxsX-2oy_w |
@tobiaskleiner - I am not sure on the status of this pull request and branch. Is this still relevant given all the other updates you have done? Please have a look and remove it if necessary. |
@GernotMaier the only part that is not yet included in the code or in the other PR is |
Agree. Please close the PR and put a comment on where the updated work is taking place. |
This PR adds the functionality defined in UC8 with the following four applications:
simtools-production-calculate-resource-estimates
-- calculates compute and storage resources --
simtools-production-generate-grid
-- generates a grid of simulation points --
simtools-production-generate-simulation-config
-- generates simulation parameters for a specific grid point --
simtools-production-scale-events
-- metric evaluation and statistical error calculations --
Modules are stored in
production_configuration
:calculate_statistical_errors_grid_point.py
derive_computing_resources.py
generate_production_grid.py
generate_simulation_config.py
interpolation_handler.py