|
42 | 42 | CInt, |
43 | 43 | Int, |
44 | 44 | IntTelescopeParameter, |
| 45 | + Float, |
45 | 46 | Set, |
46 | 47 | List, |
47 | 48 | CaselessStrEnum, |
|
52 | 53 | from ctapipe.io import read_table |
53 | 54 | from dl1_data_handler.image_mapper import ImageMapper |
54 | 55 |
|
| 56 | +#: Area averaged position of LST-1, MAGIC-1 and MAGIC-2 (using 23**2 and 17**2 m2) |
| 57 | +REFERENCE_LOCATION = EarthLocation( |
| 58 | + lon=-17.890879 * u.deg, |
| 59 | + lat=28.761579 * u.deg, |
| 60 | + height=2199 * u.m, # MC obs-level |
| 61 | +) |
55 | 62 | # Reference (dummy) time to insert in the SkyCoord object as the default time |
56 | 63 | LST_EPOCH = Time("2018-10-01T00:00:00", scale="utc") |
57 | 64 |
|
@@ -161,6 +168,30 @@ class DLDataReader(Component): |
161 | 168 | help="Skip files that are not compatible to the reference instead of raising an error", |
162 | 169 | ).tag(config=True) |
163 | 170 |
|
| 171 | + reference_position_lon = Float( |
| 172 | + default_value=REFERENCE_LOCATION.lon.deg, |
| 173 | + help=( |
| 174 | + "Longitude of the reference location for telescope GroundFrame coordinates." |
| 175 | + " Default is the roughly area weighted average of LST-1, MAGIC-1 and MAGIC-2." |
| 176 | + ) |
| 177 | + ).tag(config=True) |
| 178 | + |
| 179 | + reference_position_lat = Float( |
| 180 | + default_value=REFERENCE_LOCATION.lat.deg, |
| 181 | + help=( |
| 182 | + "Latitude of the reference location for telescope GroundFrame coordinates." |
| 183 | + " Default is the roughly area weighted average of LST-1, MAGIC-1 and MAGIC-2." |
| 184 | + ) |
| 185 | + ).tag(config=True) |
| 186 | + |
| 187 | + reference_position_height = Float( |
| 188 | + default_value=REFERENCE_LOCATION.height.to_value(u.m), |
| 189 | + help=( |
| 190 | + "Height of the reference location for telescope GroundFrame coordinates." |
| 191 | + " Default is current MC obslevel." |
| 192 | + ) |
| 193 | + ).tag(config=True) |
| 194 | + |
164 | 195 | allowed_tel_types = List( |
165 | 196 | default_value=None, |
166 | 197 | allow_none=True, |
@@ -269,8 +300,16 @@ def __init__( |
269 | 300 | f"When processing real observational data, please provide a single file (currently: '{len(self.files)}')." |
270 | 301 | ) |
271 | 302 |
|
| 303 | + # Set the reference location from the config |
| 304 | + reference_location = EarthLocation( |
| 305 | + lon=self.reference_position_lon * u.deg, |
| 306 | + lat=self.reference_position_lat * u.deg, |
| 307 | + height=self.reference_position_height * u.m, |
| 308 | + ) |
272 | 309 | # Set up the subarray |
273 | 310 | self.subarray = SubarrayDescription.from_hdf(self.first_file) |
| 311 | + # Overwrite the reference location of the subarray |
| 312 | + self.subarray.reference_location = reference_location |
274 | 313 | selected_tel_ids = None |
275 | 314 | if self.allowed_tels is not None: |
276 | 315 | selected_tel_ids = np.array(list(self.allowed_tels), dtype=np.int16) |
@@ -317,7 +356,8 @@ def __init__( |
317 | 356 | for filename in self.files: |
318 | 357 | # Read SubarrayDescription from the new file |
319 | 358 | subarray = SubarrayDescription.from_hdf(filename) |
320 | | - |
| 359 | + # Overwrite the reference location of the subarray |
| 360 | + subarray.reference_location = reference_location |
321 | 361 | # Filter subarray by selected telescopes |
322 | 362 | if selected_tel_ids is not None: |
323 | 363 | subarray = subarray.select_subarray(self.tel_ids) |
|
0 commit comments