-
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
Simplify file naming in names.py #835
Conversation
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.
Thanks for the PR. It looks good in general and improves readability of the code a lot. I have added few minor comments.
simtools/camera_efficiency.py
Outdated
@@ -193,7 +183,7 @@ def analyze(self, export=True, force=False): | |||
""" | |||
self._logger.info("Analyzing CameraEfficiency") | |||
|
|||
if self._file_results.exists() and not force: | |||
if self._file["results"].exists() and not force: |
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.
Better to use if "results" in self._file
for dict. Also codecov complains about missing test. Maybe you can add tests? Also for the following two lines 225 and 303.
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 (your first point).
I am not adding tests - all what I have changed is this one line which triggered codecov. No new logic has been introduced.
Both camera_efficiency and ray_tracing modules need a good review. I had a quick look, and it is not straight forward to add tests to those rather long functions. I do think this requires far more attention than adding a quick test to make codecov happy.
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.
Ok I agree. This would then probably go in a seperate PR. If you agree we can open an issue to adress this.
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 and no. We have all the tools like pycoverage and codecov to tell us the missing tests. Do we need to open additionally issues on that? I am really not sure.
this_mirror if self.config.single_mirror_mode else None, | ||
self.label, | ||
"photons", | ||
photons_file_name = names.generate_file_name( |
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.
Line not covered by test.
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, same thing.
simtools/utils/names.py
Outdated
|
||
Parameters | ||
---------- | ||
file_type: str | ||
Type of file (e.g., config, output, plot) | ||
key: str |
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.
This should be named suffix. Description is not matching.
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.
Exactly. Changed it.
@@ -12,7 +12,7 @@ | |||
|
|||
def test_reading_simtel_file(args_dict, io_handler): | |||
test_file = io_handler.get_input_data_file( | |||
file_name="photons-North-LSTN-01-d10.0-za20.0-off0.000_validate_optics.lis.gz", | |||
file_name="photons-North-LSTN-01-d10.0km-za20.0deg-off0.000deg_validate_optics.lis.gz", |
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.
Why do we use here 0.000deg
for 0 offset, but above 000deg
for 0 azimuth angle?
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.
This is motivated by:
- zenith and offset angle needs to be set on a sub-degree accuracy
- azimuth not - it is probably impossible to see a difference between a shower coming from 180 or 185 deg.
I am generally not a friend of putting metadata in the file name. This information should be in a metdata header. We should fix this at some point in the future.
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 this makes sense, but do we really need milli degree accuracy for offset? Agree to put this in the metadata in the future.
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.
We actually have simulated at 0.125 deg offset at some point, so this is not completely wrong.
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.
Ok thanks, everything is clear then. Going to mark it as approved.
) | ||
== "camera-efficiency-table-North-MST-FlashCam-D-za040deg_azm000deg_test.ecsv" | ||
== "camera-efficiency-table-North-MSTN-za40.0deg_azm000deg_test.ecsv" |
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.
Related to previous comment, also seen later a couple of times.
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.
Same reply - I've commented on zenith vs azimuth accuracy. Let me know if this makes sense, easy to change it to azm000.0deg
, but I don't think it makes sense (and python is horrible in getting the accuracy right)
@tobiaskleiner - thanks for the comments and suggestions! Added them or commented on the issues. Let me know if this is ok. |
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 to merge.
@tobiaskleiner - thank you! |
This PR addresses issue #798:
names.py
for output files from especially camera_efficiency and ray tracing is very repetitive. Improved this a bit, but a condensation into a single function is hardly possible. I've simplified as much as possible.