-
Notifications
You must be signed in to change notification settings - Fork 77
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
Use effective focal length to compute src-dep parameters #1131
Changes from 8 commits
e31408b
7c146d4
8543db8
b9b5b55
709219d
7871b34
a34fcff
500d7b2
fd6b0ca
0945601
09dcf48
4b95835
836030b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -18,6 +18,7 @@ | |||||||||||
|
||||||||||||
import pandas as pd | ||||||||||||
from ctapipe.instrument import SubarrayDescription | ||||||||||||
from ctapipe_io_lst import OPTICS | ||||||||||||
|
||||||||||||
from lstchain.io import ( | ||||||||||||
get_standard_config, | ||||||||||||
|
@@ -61,11 +62,17 @@ | |||||||||||
pass | ||||||||||||
|
||||||||||||
dl1_params = pd.read_hdf(dl1_filename, key=dl1_params_lstcam_key) | ||||||||||||
subarray_info = SubarrayDescription.from_hdf(dl1_filename) | ||||||||||||
tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 | ||||||||||||
focal_length = subarray_info.tel[tel_id].optics.equivalent_focal_length | ||||||||||||
|
||||||||||||
src_dep_df = pd.concat(get_source_dependent_parameters(dl1_params, config, focal_length=focal_length), axis=1) | ||||||||||||
try: | ||||||||||||
subarray_info = SubarrayDescription.from_hdf(dl1_filename) | ||||||||||||
tel_id = config["allowed_tels"][0] if "allowed_tels" in config else 1 | ||||||||||||
effective_focal_length = subarray_info.tel[tel_id].optics.effective_focal_length | ||||||||||||
except OSError: | ||||||||||||
print("subarray table is not readable because of the version inompatibility.") | ||||||||||||
print("Use the effective focal lentgh for the standard LST optics") | ||||||||||||
effective_focal_length = OPTICS.effective_focal_length | ||||||||||||
|
||||||||||||
src_dep_df = pd.concat(get_source_dependent_parameters( | ||||||||||||
dl1_params, config, effective_focal_length=effective_focal_length), axis=1) | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
cta-lstchain/lstchain/reco/dl1_to_dl2.py Line 801 in 500d7b2
cta-lstchain/lstchain/reco/dl1_to_dl2.py Lines 812 to 814 in 500d7b2
Wait, it seems the values src_x, src_y finally used in building the models and in applying them are not directly those from dl1 files, but are recalculated with effective_focal_length, so I think it is probably working. On the other hand, lstchain_add_source_dependent_parameters.py will keep the src_x, src_y that are found in the dl1 file (calculated with "equivalent f" for existing v0.9 files). I think that what is misleading is the behaviour of get_expected_source_pos: get_expected_source_pos(data, data_type, config, effective_focal_length=29.30565 * u.m) I would expect the line above to always recalculate the source position using the focal length that is passed. But for MC gammas it just returns whatever is already stored in "data" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
cta-lstchain/lstchain/reco/dl1_to_dl2.py Line 629 in 500d7b2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I said, I think you have to update get_expected_source_pos so that it recalculates the position, not just propagates... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, it is true. Then I will modify codes to always recalculate the source position inside this function. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, for source-indep we need that the target for direction RF (true source position) is also in "true camera coordinates", meaning that it contains the effect of aberration (just like the shower images). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I see. For |
||||||||||||
|
||||||||||||
metadata = global_metadata() | ||||||||||||
write_dataframe(src_dep_df, dl1_filename, dl1_params_src_dep_lstcam_key, config=config, meta=metadata) | ||||||||||||
|
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.
typos: inompatibility, lentgh
Also, better "I will use the effective..." (otherwise it seems it is asking the user for some change )
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 effective focal length for the standard LST optics will be used"