def load_diode_data( diode_data_file, apply_lowpass ): """ Loads in diode data from a tdms file given the location Parameters ---------- diode_data_file : str Location of diode data file apply_lowpass : bool Determines whether or not a lowpass filter is applied Returns ------- pandas.core.frame.DataFrame Dataframe of diode data, with time stamps removed if they are present """ # import data data = TdmsFile(diode_data_file).as_dataframe() for key in data.keys(): # remove time column if 'diode' not in key.replace('diodes', '').lower(): data = data.drop(key, axis=1) if apply_lowpass: data = data.apply(_diode_filter) return data
def load_diode_data(diode_data_file, apply_lowpass): """ Loads in diode data from a tdms file given the location Parameters ---------- diode_data_file : str Location of diode data file apply_lowpass : bool Determines whether or not a lowpass filter is applied Returns ------- pandas.core.frame.DataFrame Dataframe of diode data, with time stamps removed if they are present """ # import data tf = TdmsFile(diode_data_file) diode_channels = tf.group_channels("diodes") if len(diode_channels) == 0 or \ len(diode_channels[0].data) > 0: # diodes.tdms has data data = TdmsFile(diode_data_file).as_dataframe() for key in data.keys(): # remove time column if "diode" not in key.replace("diodes", "").lower(): data = data.drop(key, axis=1) if apply_lowpass: # noinspection PyTypeChecker data = data.apply(_diode_filter) else: # empty tdms file data = pd.DataFrame(columns=[c.path for c in diode_channels], data=np.array([[np.NaN] * 50 for _ in diode_channels]).T) return data