Skip to content
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

Errors merging files of run 2031 #412

Closed
maxnoe opened this issue May 18, 2020 · 10 comments · Fixed by #418
Closed

Errors merging files of run 2031 #412

maxnoe opened this issue May 18, 2020 · 10 comments · Fixed by #418

Comments

@maxnoe
Copy link
Member

maxnoe commented May 18, 2020

Trying to merge the files of run 2031, after some 80 subruns, no paramters can be written anymore:

$ lstchain_merge_hdf5_files -d /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/ -o dl1_v0.4.4_LST-1.Run02031.h5  -r 2031  --smart=false --no-image=true

Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0080.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0081.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0082.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0083.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0084.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0085.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0086.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0087.f
its.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0088.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0089.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0090.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0091.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0092.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0093.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0094.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0095.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0096.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0097.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0098.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0099.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0100.f
its.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0101.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0102.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0103.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0104.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0105.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0106.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0107.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0108.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0109.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0110.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0111.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0112.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0113.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0114.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0115.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0116.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0117.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0118.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0119.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0120.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0121.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0122.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0123.fits.h5
Can't append node dl1/event/telescope/parameters/LST_LSTCam from file /fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0124.fits.h5

The scripts finishes successfully though.

Runs 2032 and 2033 worked without problems.

@rlopezcoto
Copy link
Contributor

do the files (> subrun 80) contain the key dl1/event/telescope/parameters/LST_LSTCam?

@morcuended
Copy link
Member

morcuended commented May 19, 2020

do the files (> subrun 80) contain the key dl1/event/telescope/parameters/LST_LSTCam?

Yes, they do contain the table of parameters. However, the coordinates columns are not there due to the non-valid timestamps used to interpolate the pointing.

In [5]: get_dataset_keys("/fefs/aswg/data/real/DL1/20200227/v0.4.4_v00/dl1_LST-1.1.Run02031.0101.fits.h5")                                                                                                                                    
Out[5]: 
['dl1/event/telescope/image/LST_LSTCam',
 'dl1/event/telescope/parameters/LST_LSTCam',
 'instrument/subarray/layout',
 'instrument/subarray/layout.__table_column_meta__',
 'instrument/telescope/camera/LSTCam',
 'instrument/telescope/camera/LSTCam.__table_column_meta__',
 'instrument/telescope/optics',
 'instrument/telescope/optics.__table_column_meta__']


In [7]: df.columns                                                                                                                                                                                                                            
Out[7]: 
Index(['dragon_time', 'event_id', 'intensity', 'intercept', 'kurtosis',
       'leakage', 'length', 'log_intensity', 'mc_core_distance', 'n_islands',
       'num_trig_pix', 'obs_id', 'phi', 'psi', 'r', 'skewness', 'tel_id',
       'tel_pos_x', 'tel_pos_y', 'tel_pos_z', 'tib_time', 'time_gradient',
       'trigger_time', 'trigger_type', 'ucts_time', 'width', 'wl', 'x', 'y'],
      dtype='object')

At DL2 those columns should be included provided they did not exist previously and their values set to -90 deg if pointing info is missing for the whole subrun.

In principle, merging the files at DL2 level instead should be fine.

See #295 and #290.

@maxnoe
Copy link
Member Author

maxnoe commented May 19, 2020

I'm doing this to produce dl2 myself (using aict-tools). So how could I go about this?

And why are the coordinate columns missing completely instead of being filled with nan?

@morcuended
Copy link
Member

Agreed. Looking at the code again I think this should not happen anymore:

                    if pointing_file_path and event_timestamps > 0:
                        azimuth, altitude = pointings.cal_pointingposition(event_timestamps, drive_data)
                        event.pointing[telescope_id].azimuth = azimuth
                        event.pointing[telescope_id].altitude = altitude
                        dl1_container.az_tel = azimuth
                        dl1_container.alt_tel = altitude
                    else:
                        dl1_container.az_tel = u.Quantity(np.nan, u.rad)
                        dl1_container.alt_tel = u.Quantity(np.nan, u.rad)

@maxnoe
Copy link
Member Author

maxnoe commented May 19, 2020

Ok, so maybe I'll just wait until the 0.5 processing is done.

@morcuended
Copy link
Member

Ok, so maybe I'll just wait until the 0.5 processing is done.

@maxnoe, the v0.5.1 processing is finished. May you try to do the merging now?

@maxnoe
Copy link
Member Author

maxnoe commented May 22, 2020

awesome! Yes, will do.

@maxnoe
Copy link
Member Author

maxnoe commented May 22, 2020

@morcuended I tried with:

lstchain_merge_hdf5_files -d /fefs/aswg/data/real/DL1/20200227/v0.5.1_v03/ -o dl1_v0.5.1_LST-1.Run02031.h5  -r 2031  --smart=false --no-image=true 

But now the files do not contain any dl1 parameters, only the instrument and dl1datacheck groups

@morcuended
Copy link
Member

Probably because it is also trying to merge datacheck_dl1_*.h5 files

In [3]: get_dataset_keys("/fefs/aswg/data/real/DL1/20200227/v0.5.1_v03/datacheck_dl1_LST-1.Run02031.0000.h5")                                                                                                                                 
Out[3]: 
['dl1datacheck/cosmics',
 'dl1datacheck/flatfield',
 'dl1datacheck/histogram_binning',
 'dl1datacheck/pedestals',
 'dl1datacheck/used_trigger_tag',
 'instrument/telescope/camera/LSTCam',
 'instrument/telescope/camera/LSTCam.__table_column_meta__']

But actually the dl1 files do contain image table:

In [2]: get_dataset_keys("/fefs/aswg/data/real/DL1/20200227/v0.5.1_v03/dl1_LST-1.Run02031.0000.h5")                                                                                                                                           
Out[2]: 
['dl1/event/telescope/image/LST_LSTCam',
 'dl1/event/telescope/monitoring/calibration',
 'dl1/event/telescope/monitoring/flatfield',
 'dl1/event/telescope/monitoring/pedestal',
 'dl1/event/telescope/parameters/LST_LSTCam',
 'instrument/subarray/layout',
 'instrument/subarray/layout.__table_column_meta__',
 'instrument/telescope/camera/LSTCam',
 'instrument/telescope/camera/LSTCam.__table_column_meta__',
 'instrument/telescope/optics',
 'instrument/telescope/optics.__table_column_meta__']

I guess the merge script should avoid those other datacheck files

@maxnoe
Copy link
Member Author

maxnoe commented May 22, 2020

I wanted to open a more general issue anyways about not giving directories as argument but a variadic number of files.

In my experience, this leads much less often to unexpected behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants