@@ -1145,7 +1145,10 @@ def _get_pulse_ids(self):
11451145
11461146 if not counts :
11471147 # Immediately return an empty series if there is no data.
1148- return pd .Series ([], dtype = np .int32 )
1148+ index = pd .MultiIndex .from_arrays ([
1149+ np .zeros (0 , dtype = np .uint64 ), np .zeros (0 , dtype = np .int64 )
1150+ ], names = ['trainId' , 'pulseIndex' ])
1151+ return pd .Series ([], index = index , dtype = np .int32 )
11491152
11501153 index = pd .MultiIndex .from_arrays ([
11511154 np .repeat (self ._key .train_id_coordinates (), counts ),
@@ -1899,13 +1902,19 @@ def _get_pulse_ids(self):
18991902 fel_by_train .append (np .isin (pids , fel_pids ))
19001903 ppl_by_train .append (np .isin (pids , ppl_pids ))
19011904
1905+ def concat_1d (arrays , dtype ): # Allows an empty list of arrays
1906+ if len (arrays ) == 0 :
1907+ return np .zeros (0 , dtype = dtype )
1908+ return np .concatenate (arrays )
1909+
19021910 index = pd .MultiIndex .from_arrays ([
19031911 np .repeat (train_ids , counts ),
1904- np .concatenate ([np .arange (count ) for count in counts ]),
1905- np .concatenate (fel_by_train ), np .concatenate (ppl_by_train )
1912+ concat_1d ([np .arange (count ) for count in counts ], np .int64 ),
1913+ concat_1d (fel_by_train , np .bool_ ),
1914+ concat_1d (ppl_by_train , np .bool_ ),
19061915 ], names = ['trainId' , 'pulseIndex' , 'fel' , 'ppl' ])
19071916
1908- return pd .Series (data = np . concatenate (pids_by_train ),
1917+ return pd .Series (data = concat_1d (pids_by_train , np . int32 ),
19091918 index = index , dtype = np .int32 )
19101919
19111920 def _get_pulse_mask (self , reduced = False ):
0 commit comments