Find and display pointing nodes using lstmcpipe

Find and display pointing nodes using lstmcpipe#

[1]:
import lstmcpipe
print(f"lstmcpipe v{lstmcpipe.__version__}")
lstmcpipe v0.10.0
[2]:
import os
import matplotlib.pyplot as plt
from lstmcpipe.config import paths_config

Creating a PathConfig#

In lstmcpipe, a PathConfig handles the paths to the different data levels, models, etc… that will then help orchestrate all the jobs and their dependencies.

We need to create one to load the existing poitings. To do so, you need to run the following on the cluster at La Palma.

You will find different PathConfig in the paths_config module depending on what you want to do. Here we’ll use the PathConfigAllSkyFull one, that can orchestrate a complete analysis for the AllSky production.

[3]:
paths_config.PathConfigAllSkyFull?
Init signature: paths_config.PathConfigAllSkyFull(prod_id, dec_list)
Docstring:      Base class to generate a Path configuration for a production
Init docstring:
Does training and testing for a list of declinations

Parameters
----------
prod_id: str
dec_list: [str]
File:           /fefs/aswg/workspace/thomas.vuillaume/software/miniconda3/envs/lstmcpipe/lib/python3.7/site-packages/lstmcpipe/config/paths_config.py
Type:           type
Subclasses:     PathConfigAllSkyFullDL1ab

NB: The dec_list is used for the training nodes only. There will be as many models trained as declination provided.

The available declinations can be found here:

[4]:
dec_list = os.listdir("/fefs/aswg/data/mc/DL0/LSTProd2/TrainingDataset/Protons")
dec_list
[4]:
['dec_6166',
 'dec_min_2924',
 'dec_931',
 'dec_3476',
 'dec_6676',
 'dec_min_413',
 'dec_2276',
 'dec_4822',
 'dec_min_1802']
[5]:
config = paths_config.PathConfigAllSkyFull('all_decs', dec_list)

Training configs#

There is one PathConfigAllSkyTraining per pointing:

[6]:
config.train_configs
[6]:
{'dec_6166': <lstmcpipe.config.paths_config.PathConfigAllSkyTraining at 0x7fecc8da1810>,
 'dec_min_2924': <lstmcpipe.config.paths_config.PathConfigAllSkyTraining at 0x7fecc8da14d0>,
 'dec_931': <lstmcpipe.config.paths_config.PathConfigAllSkyTraining at 0x7fecc8da1750>,
 'dec_3476': <lstmcpipe.config.paths_config.PathConfigAllSkyTraining at 0x7fecc8da1450>,
 'dec_6676': <lstmcpipe.config.paths_config.PathConfigAllSkyTraining at 0x7fecc8da1690>,
 'dec_min_413': <lstmcpipe.config.paths_config.PathConfigAllSkyTraining at 0x7fecc8da1390>,
 'dec_2276': <lstmcpipe.config.paths_config.PathConfigAllSkyTraining at 0x7fecc8da15d0>,
 'dec_4822': <lstmcpipe.config.paths_config.PathConfigAllSkyTraining at 0x7fecc8da1310>,
 'dec_min_1802': <lstmcpipe.config.paths_config.PathConfigAllSkyTraining at 0x7fecc8da1910>}

For each of them, one can access the config, and in particular the pointings

[7]:
config.train_configs['dec_2276'].pointings
[7]:
QTable length=19
altazdirname_GammaDiffusedirname_Protons
degdeg
float64float64str37str29
23.55400000000000275.983node_corsika_theta_66.446_az_75.983_node_theta_66.446_az_75.983_
23.554000000000002284.017node_corsika_theta_66.446_az_284.017_node_theta_66.446_az_284.017_
30.65879.18node_corsika_theta_59.342_az_79.180_node_theta_59.342_az_79.180_
30.658280.82node_corsika_theta_59.342_az_280.820_node_theta_59.342_az_280.820_
37.83882.384node_corsika_theta_52.162_az_82.384_node_theta_52.162_az_82.384_
37.838277.616node_corsika_theta_52.162_az_277.616_node_theta_52.162_az_277.616_
45.07385.716node_corsika_theta_44.927_az_85.716_node_theta_44.927_az_85.716_
45.073274.284node_corsika_theta_44.927_az_274.284_node_theta_44.927_az_274.284_
52.33989.359node_corsika_theta_37.661_az_89.359_node_theta_37.661_az_89.359_
52.339270.641node_corsika_theta_37.661_az_270.641_node_theta_37.661_az_270.641_
59.6193.64node_corsika_theta_30.390_az_93.640_node_theta_30.390_az_93.640_
59.61266.36node_corsika_theta_30.390_az_266.360_node_theta_30.390_az_266.360_
66.83999.261node_corsika_theta_23.161_az_99.261_node_theta_23.161_az_99.261_
66.839260.739node_corsika_theta_23.161_az_260.739_node_theta_23.161_az_260.739_
73.913108.09node_corsika_theta_16.087_az_108.090_node_theta_16.087_az_108.090_
73.913251.91node_corsika_theta_16.087_az_251.910_node_theta_16.087_az_251.910_
80.42099999999999126.888node_corsika_theta_9.579_az_126.888_node_theta_9.579_az_126.888_
80.42099999999999233.112node_corsika_theta_9.579_az_233.112_node_theta_9.579_az_233.112_
84.0180.0node_corsika_theta_6.000_az_180.000_node_theta_6.000_az_180.000_

One can display them:

[8]:
config.train_configs['dec_2276'].plot_pointings()
[8]:
<PolarAxesSubplot:xlabel='Azimuth'>
../_images/examples_configs_pointings_13_1.png

Test config#

One can do the same for the testing nodes.

There is also one config per test, since each trained model will be applied to the test nodes to produce the dedicated IRFs

[9]:
config.test_configs
[9]:
{'dec_6166': <lstmcpipe.config.paths_config.PathConfigAllSkyTesting at 0x7fecc8da1510>,
 'dec_min_2924': <lstmcpipe.config.paths_config.PathConfigAllSkyTesting at 0x7fecc8da12d0>,
 'dec_931': <lstmcpipe.config.paths_config.PathConfigAllSkyTesting at 0x7fecc8da1950>,
 'dec_3476': <lstmcpipe.config.paths_config.PathConfigAllSkyTesting at 0x7fecc8da1990>,
 'dec_6676': <lstmcpipe.config.paths_config.PathConfigAllSkyTesting at 0x7fecc8da19d0>,
 'dec_min_413': <lstmcpipe.config.paths_config.PathConfigAllSkyTesting at 0x7fecc8da1a10>,
 'dec_2276': <lstmcpipe.config.paths_config.PathConfigAllSkyTesting at 0x7fecc8da1a50>,
 'dec_4822': <lstmcpipe.config.paths_config.PathConfigAllSkyTesting at 0x7fecc8da1a90>,
 'dec_min_1802': <lstmcpipe.config.paths_config.PathConfigAllSkyTesting at 0x7fecc8da1ad0>}
[10]:
config.test_configs['dec_2276'].pointings
[10]:
QTable length=79
altazdirname
degdeg
float64float64str29
16.858000000000004331.979node_theta_73.142_az_331.979_
19.268330.659node_theta_70.732_az_330.659_
46.80387.604node_theta_43.197_az_87.604_
21.932000000000002283.075node_theta_68.068_az_283.075_
37.626216.698node_theta_52.374_az_216.698_
29.472175.158node_theta_60.528_az_175.158_
29.340000000000003327.483node_theta_60.66_az_327.483_
37.626197.973node_theta_52.374_az_197.973_
37.626110.312node_theta_52.374_az_110.312_
75.016175.158node_theta_14.984_az_175.158_
52.18690.0node_theta_37.814_az_90_
46.803230.005node_theta_43.197_az_230.005_
32.005327.238node_theta_57.995_az_327.238_
46.803175.158node_theta_43.197_az_175.158_
80.0248.117node_theta_10.0_az_248.117_
54.09617.462node_theta_35.904_az_17.462_
21.932000000000002231.243node_theta_68.068_az_231.243_
.........
50.354335.667node_theta_39.646_az_335.667_
14.774000000000001213.73node_theta_75.226_az_213.73_
21.932000000000002175.158node_theta_68.068_az_175.158_
46.803120.311node_theta_43.197_az_120.311_
26.744999999999997327.961node_theta_63.255_az_327.961_
7.844999999999999271.199node_theta_82.155_az_271.199_
66.37259.265node_theta_23.630_az_259.265_
57.941136.053node_theta_32.059_az_136.053_
21.715999999999994329.555node_theta_68.284_az_329.555_
37.626175.158node_theta_52.374_az_175.158_
14.77400000000000131.342node_theta_75.226_az_31.342_
37.626240.004node_theta_52.374_az_240.004_
21.932000000000002141.683node_theta_68.068_az_141.683_
29.34000000000000332.517node_theta_60.66_az_32.517_
21.932000000000002119.073node_theta_68.068_az_119.073_
37.626152.343node_theta_52.374_az_152.343_
42.048270.0node_theta_47.952_az_270_
57.941175.158node_theta_32.059_az_175.158_
[11]:
config.test_configs['dec_2276'].plot_pointings()
[11]:
<PolarAxesSubplot:xlabel='Azimuth'>
../_images/examples_configs_pointings_17_1.png

Put them all together#

[12]:
ax = config.test_configs['dec_2276'].plot_pointings(color='black', marker='*')

for dec, cfg in config.train_configs.items():
    ax = cfg.plot_pointings(ax=ax, alpha=0.6, s=10)
ax.legend(bbox_to_anchor=(1.1, 1.05))
[12]:
<matplotlib.legend.Legend at 0x7fecc8b0a390>
../_images/examples_configs_pointings_19_1.png

Or in 3D

[13]:
ax = config.test_configs['dec_2276'].plot_pointings(projection='3d', color='black', marker='*')

for dec, cfg in config.train_configs.items():
    ax = cfg.plot_pointings(ax=ax, projection='3d', alpha=0.6, s=10)
ax.legend(bbox_to_anchor=(1.1, 1.05))
[13]:
<matplotlib.legend.Legend at 0x7fecc89f8f90>
../_images/examples_configs_pointings_21_1.png
[ ]: