-
Notifications
You must be signed in to change notification settings - Fork 3
Separate TelescopeModel and SiteModel for sim_telarray configuration writer #1489
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
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.
This comment has been minimized.
This comment has been minimized.
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.
Very nice. Simplifies the structure, some of the code and makes things clearer. Minor comments.
) | ||
|
||
@property | ||
def config_file_directory(self): | ||
"""Directory for configure files. Configure, if necessary.""" | ||
if self._config_file_directory is None: | ||
self._set_config_file_directory_and_name() | ||
return self._config_file_directory | ||
return self._config_file_directory or self._set_config_file_directory_and_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.
Wouldn't this make the code above it checking if None
redundant? I suggest applying the same lazy init to the config_file_path while we are at it.
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. Fixed it.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
Analysis Details0 IssuesCoverage and DuplicationsProject ID: gammasim_simtools_AY_ssha9WiFxsX-2oy_w |
@orelgueta - thanks for the review! Please have another look, I think I've followed all your suggestions. |
if self._config_file_directory is None: | ||
self._set_config_file_directory_and_name() | ||
return self._config_file_directory or self._set_config_file_directory_and_name() | ||
return self._config_file_directory |
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 thought the opposite, i.e., that
return self._config_file_directory or self._set_config_file_directory_and_name()
would cover both cases and you won't need
if self._config_file_directory is None:
self._set_config_file_directory_and_name()
But it doesn't matter, we can keep it like this.
TelescopeModel and SiteModel have not been separated in the ModelParameter and SimtelConfigWriter routines - site parameters have been added simply to the telescope model. This had some side effects, like that checks for site parameters where necessary when writing telescope parameters.
This PR refactors the code and introduces a clear separation of TelescopeModel and SiteModel. Unfortunately, this required quite some changes, but I think the code is now easier to read and definitely more consistent.
Notes:
ModelParameter.get_config_file
has been removed and replaced byget_config_file
(a property) andwrite_sim_telarray_config_file
(this hopefully clarifies from where we call the config file writer).array_triggers
parameter as part of TelescopeModel in the code. These will be fixed in a follow up PR.