cta-observatory / cta-lstchain

LST prototype testbench chain
https://cta-observatory.github.io/cta-lstchain/
BSD 3-Clause "New" or "Revised" License
25 stars 77 forks source link

The table named "tels_with_trigger contains telescopes other than allowed_tels #550

Open hyuga-abe opened 4 years ago

hyuga-abe commented 4 years ago

I have used lstchain:v0.6.3 and ctapipe:v0.8.0.

The script "reco/r0_to_dl1.py" generates dl1 file. The dl1 file contains many tables and there is "tels_with_trigger" in "dl1/event/subarray/trigger/" group. One can set "allowed_tels" when processing, but currently it does not seem to work for the table. The "tels_with_trigger" is there without any change and that should be an issue.

I resolved the issue by adding the following object

class Mapper:
    def __init__(self, allowed_tels, max_tels):
        self.mapper = partial(utils.expand_tel_list, max_tels=max_tels)
        self.tel_mask = self.mapper(allowed_tels)
    def __call__(self, tel_list):
        tel_map = self.mapper(tel_list)
        tel_map = np.array([v*m for v, m in zip(self.tel_mask, tel_map)])
        return tel_map

and modifying the lines number 335-338

 tel_list_transform = partial(
     utils.expand_tel_list,
     max_tels=max(subarray.tel) + 1,
)

to

tel_list_transform = Mapper(
    allowed_tels = config["allowed_tels"],
    max_tels=max(subarray.tel) + 1,
)

with the "Mapper".

Your opinion would be appreciated. Best Regards.

maxnoe commented 4 years ago

I am not sure "allowed_telescopes" should affect "tels_with_trigger". It is important information that an event might have been triggered by a telescope you don't want to include and it's not clear how to treat e.g. events that are triggered by only two telescopes, one of which was excluded.

So I think it is best to have tels_with_trigger also include the discarded telescope, so that information is kept.

hyuga-abe commented 4 years ago

Thanks for the quick response. The generated dl1 file doesn't include the discarded telescope information (e.g. image, parameters..) other than tels_with_trigger. Could you tell me why you are saying the only triggered telescope information should be kept? The information would be used anywhere afterward? Thank you.