Skip to content

Last updated scripts (4-LSTs): Torino group - #180

Draft
Elisa-Visentin wants to merge 12 commits into
masterfrom
Torino
Draft

Last updated scripts (4-LSTs): Torino group#180
Elisa-Visentin wants to merge 12 commits into
masterfrom
Torino

Conversation

@Elisa-Visentin

Copy link
Copy Markdown
Collaborator

Here the last updated analysis steps (RFs, DL2, DL3): new RF implementation (one per telescope instead of one per telescope per combination).
Again a huge PR, and it would be great if we could merge it before the LST school (to remove hardcoded variables and duplicated functions due to the new-old glueing at the DL1-stereo level).
The Doc strings must still be fixed a bit (to pass the tests), but you can already take a look into it.
Thanks

@aleberti

aleberti commented Dec 5, 2023

Copy link
Copy Markdown
Collaborator

Hi, many changes are in the documentation of the functions, but most of them, they should not have been changed. I.e. the spaces removed between the name of the parameter and the colon. I think you have some setting in your editor which is removing them automatically, but that makes the lint and docs checks fail.

@codecov

codecov Bot commented Dec 5, 2023

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.39130% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.36%. Comparing base (9b8776e) to head (e5d8a1a).
⚠️ Report is 1069 commits behind head on master.

Files with missing lines Patch % Lines
magicctapipe/io/io.py 85.41% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #180      +/-   ##
==========================================
- Coverage   76.17%   75.36%   -0.82%     
==========================================
  Files          21       21              
  Lines        2493     2419      -74     
==========================================
- Hits         1899     1823      -76     
- Misses        594      596       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Elisa-Visentin

Elisa-Visentin commented Dec 5, 2023 via email

Copy link
Copy Markdown
Collaborator Author

@Elisa-Visentin

Copy link
Copy Markdown
Collaborator Author

Fixed :)

@Elisa-Visentin
Elisa-Visentin marked this pull request as ready for review December 6, 2023 07:25
Comment thread magicctapipe/scripts/lst1_magic/lst1_magic_train_rfs.py Outdated
Comment thread magicctapipe/scripts/lst1_magic/lst1_magic_train_rfs.py
Comment thread magicctapipe/scripts/lst1_magic/lst1_magic_create_irf.py Outdated
@aleberti

aleberti commented Dec 8, 2023

Copy link
Copy Markdown
Collaborator

I do not have any major comment. @jsitarek can you also have a look? it should be fast anyway.

@aleberti
aleberti requested a review from jsitarek December 8, 2023 15:33

@jsitarek jsitarek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I left a few comment/questions

Comment thread magicctapipe/io/io.py Outdated
Comment thread magicctapipe/io/io.py Outdated
# The events of the MAGIC-stereo combination are excluded
df_events.query("(combo_type > 0) & (magic_stereo == True)", inplace=True)
df_events.query(
f"(combo_type < {combo_types[-1]}) & (magic_stereo == True)", inplace=True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

taking into account the other problem that we had with the combo_type it might be safer to access this combination by name "M1_M2"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment thread magicctapipe/io/io.py Outdated
elif event_type == "software_only_3tel":
df_events.query("combo_type == 3", inplace=True)
elif event_type == "software_6_tel":
df_events.query(f"combo_type < {combo_types[-1]}", inplace=True)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment thread magicctapipe/io/io.py Outdated

elif event_type == "magic_only":
df_events.query("combo_type == 0", inplace=True)
df_events.query(f"combo_type == {combo_types[-1]}", inplace=True)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment thread magicctapipe/io/io.py Outdated
If the input event type is not known
"""

TEL_NAMES, TEL_COMBINATIONS = telescope_combinations(config)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the same 6 lines are also in load_mc_dl2_data_file
better to extract them in a separate function to make sure that the same code is used for data and MCs

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

the only difference is that in real data we do not ask for magic_stereo == True in the 'software' because standard MAGIC + LST-1 data are always collected with MAGIC stereo trigger, but we can take this into account easily

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Comment thread magicctapipe/io/io.py Outdated
Comment thread magicctapipe/io/io.py Outdated
event_data.query(f"combo_type == {combo_types[-1]}", inplace=True)

elif event_type == "hardware":
logger.warning(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hardware trigger is already implemented in ctapipe_io_magic

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed

for the events of the any 2-tel combinations except the MAGIC-stereo
combination at the moment. The "software_only_3tel" type allows for only
the events of the 3-tel combination. The "magic_only" type allows for
The "software_3tels_or_more" type stands for the software event

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if we modify the types following my earlier comment they need to be updated here as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

changed

combo_type = list(TEL_COMBINATIONS.values()).index(tel_ids)
df_events = event_data.query(f"combo_type == {combo_type}")
# Extract the events with the same telescope ID
df_events = event_data.query(f"tel_id == {tel_ids[0]}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I do not understand why do you always take the first tel_id here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because the tel_ids list (i.e., the dictionary in 'estimator') only contains one element (we create one RF file per telescope and this 'list' will contain the ID of the telescope corresponding to the used RF file). So we take always the first because ti is the only tel_id

@aleberti aleberti linked an issue Jan 19, 2024 that may be closed by this pull request
@aleberti aleberti added enhancement New feature or request new functionality For new functionalities optimization For code optimization labels Jan 19, 2024
@Elisa-Visentin

Copy link
Copy Markdown
Collaborator Author

Due to the large number of conflict with the master (and the 'timescale' of the commits both here and in the master, which will probably cause a mess if we try to merge them), I will open a new branch from the current master (ctapipe 0.19) to implement 'manually' the changes in the RFs; we can then merge this new branch. This PR will be kept open as a draft to allow us to solve the open conversations

@Elisa-Visentin Elisa-Visentin mentioned this pull request Apr 28, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request new functionality For new functionalities optimization For code optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants