Skip to content

Commit e1cf033

Browse files
author
Marcel Strzys
committed
<fix>
- addressed the comments in the MR by Max regarding the time scale read from the file and ensured it is converted to utc - tested the drift scan mode using a test simulation - using a not implemented methods will now raise an error instead of jsut printing a warning - Ievgen and Marcel decided to not keep the time object (comment by Max), but to keep the current implementation to ensure the consistency of the variables and for a performance boost
1 parent 33ea973 commit e1cf033

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/pybkgmodel/data.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def load_events(cls, file_name):
668668
)
669669

670670
evt_time = evt_data['TIME'].quantity + ref_epoch
671-
event_data['mjd'] = evt_time.mjd * u.d
671+
event_data['mjd'] = evt_time.utc.mjd * u.d
672672

673673
# TODO: current observatory location only La Palma, no mandatory header keyword
674674
obs_loc = EarthLocation(lat=28.761758*u.deg,
@@ -700,14 +700,15 @@ def load_events(cls, file_name):
700700
) * u.deg
701701

702702
elif evt_head['OBS_MODE'] == 'DRIFT':
703-
# TODO: function not tested yet, since no data at hand to test, hence
704-
# preliminary implementation
705703

706-
coords = SkyCoord(evt_head['ALT_PNT'] *u.deg,
707-
evt_head['AZ_PNT'] *u.deg,
704+
coords = SkyCoord(alt = evt_head['ALT_PNT'] *u.deg \
705+
* np.ones_like(event_data['mjd'].value),
706+
az = evt_head['AZ_PNT'] *u.deg \
707+
* np.ones_like(event_data['mjd'].value),
708708
obstime=astropy.time.Time(event_data['mjd'], format='mjd'),
709709
location=obs_loc,
710-
frame='altaz')
710+
frame='altaz'
711+
)
711712

712713
radec_pointing = coords.transform_to('icrs')
713714

@@ -717,14 +718,8 @@ def load_events(cls, file_name):
717718
event_data['pointing_dec'] = radec_pointing.dec
718719

719720
else:
720-
print("Observation mode currently not supported.\
721-
Function will return zeros for the event location.\
722-
Supported modes: POINTING, DRIFT")
723-
724-
event_data['pointing_zd'] = np.zeros(len(event_data['mjd'])) * u.deg
725-
event_data['pointing_az'] = np.zeros(len(event_data['mjd'])) * u.deg
726-
event_data['pointing_ra'] = np.zeros(len(event_data['mjd'])) * u.deg
727-
event_data['pointing_dec'] = np.zeros(len(event_data['mjd'])) * u.deg
721+
raise TypeError(f"Observation mode {evt_head['OBS_MODE']} currently not \
722+
supported. Supported modes: POINTING, DRIFT")
728723

729724
except KeyError:
730725
print(f"File {file_name} corrupted or missing the Events hdu." +

0 commit comments

Comments
 (0)