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

Read site names from list of array elements #928

Merged
merged 6 commits into from
May 24, 2024
Merged

Conversation

GernotMaier
Copy link
Contributor

@GernotMaier GernotMaier commented May 17, 2024

This is a follow-up PR to reduce the number of hard-wired values in names.py - this time removing the list of sites and replaces it by reading the sites from the array elements file in simtools/schemas/array_elements.yml.

Remove also the ambiguity in site definitions (it is South/North (or whatever is defined in simtools/schemas/array_elements.yml) - not CTAO-South, not CTA-South, Paranal, paranal etc).

@GernotMaier GernotMaier self-assigned this May 17, 2024
@GernotMaier GernotMaier marked this pull request as ready for review May 22, 2024 06:48
Copy link
Contributor

@VictorBarbosaMartins VictorBarbosaMartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @GernotMaier, I provide a couple of comments but in general all good here.

Comment on lines 47 to 48
The list of sites is derived from location of available array elements
Return a dictionary for compatibility with the validation routines.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this explanation a bit confusing. Could you please improve it a bit?
E.g. "The list of sites is derived from the array element schema file."
"Returns a dictionary that is compatible with..."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, improved it.

@@ -34,7 +34,7 @@
# - {CLASS: null, DESCRIPTION: null, ID: null, SITE: null, SUBTYPE: null, TYPE: null}
# DOCUMENT:
# - {CREATION_TIME: null, ID: null, TITLE: null, TYPE: null, URL: null}
# INSTRUMENT: {CLASS: null, DESCRIPTION: null, ID: null, SITE: CTA-North, SUBTYPE: null, TYPE: null}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This made me realize that we still have a lot of references to "CTA" in the code, whereas it should now be "CTAO". Should we open an issue to change that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't spend time on it now but only when a new version of the metadata documents is released. There might be other changes to be done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I just created an issue such that we don;t forget about it. No need to work on that now

Comment on lines -41 to +42
"South": ["paranal", "south", "cta-south", "ctao-south", "s"],
"North": ["lapalma", "north", "cta-north", "ctao-north", "n"],
"South": ["south"],
"North": ["north"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need such a validation now that only one string name is accepted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation still works with a dict, as the general validation routine in names.py (names._validate_name) requires a dict.

@GernotMaier
Copy link
Contributor Author

@VictorBarbosaMartins - thanks for looking into it. I've improved the docstring, let me know if I should do anything else.

Copy link
Contributor

@VictorBarbosaMartins VictorBarbosaMartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good.

@GernotMaier GernotMaier merged commit 70a45ec into main May 24, 2024
16 checks passed
@GernotMaier GernotMaier deleted the read-sites-from-schema branch May 24, 2024 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants