Dataset_Management.py
def _get_labels(self, time_window, trace_number):
        "Returns classes and bboxes inside the signal window"
        dset_p = self.File['Volt_' + str(trace_number+1) + '/parameters']
        pulses_inside_window = np.where((torch.from_numpy(dset_p[0,:]) > time_window[0].cpu()) & \
                                        (torch.from_numpy(dset_p[0,:]) < time_window[-1].cpu()))[0]
        pulses_inside_window = pulses_inside_window.tolist()
        
        start_times = dset_p[0,pulses_inside_window]
        #pulse_widths = dset_p[1,pulses_inside_window]
        #pulse_categories = dset_p[2,pulses_inside_window]
        pulse_widths = dset_p[2,pulses_inside_window]
        pulse_amplitudes = dset_p[3,pulses_inside_window]
        
        number_of_pulses = len(pulses_inside_window)
        if number_of_pulses == 0:
            average_width = 0.0
            average_amplitude = 0.0
        else:
            average_width = np.average(pulse_widths)
            average_amplitude = np.average(pulse_amplitudes)

        starts = (torch.from_numpy(start_times) - time_window[0].cpu()) / self.window
        widths = torch.from_numpy(pulse_widths) / self.window
        amplitudes = torch.from_numpy(pulse_amplitudes)
        
        return starts, widths, amplitudes, number_of_pulses, average_width, average_amplitude
Returns classes and bboxes inside the signal window
Returns classes and bboxes inside the signal window
Returns classes and bboxes inside the signal window
def _get_labels(self, time_window, trace_number):
        dset_p = self.File['Volt_' + str(trace_number+1) + '/parameters']
        pulses_inside_window = np.where((torch.from_numpy(dset_p[0,:]) > time_window[0].cpu()) & \
                                        (torch.from_numpy(dset_p[0,:]) < time_window[-1].cpu()))[0]
        pulses_inside_window = pulses_inside_window.tolist()
        start_times = dset_p[0,pulses_inside_window]
        pulse_widths = dset_p[2,pulses_inside_window]
        pulse_amplitudes = dset_p[3,pulses_inside_window]
        number_of_pulses = len(pulses_inside_window)
        if number_of_pulses == 0:
            average_width = 0.0
            average_amplitude = 0.0
        else:
            average_width = np.average(pulse_widths)
            average_amplitude = np.average(pulse_amplitudes)
        starts = (torch.from_numpy(start_times) - time_window[0].cpu()) / self.window
        widths = torch.from_numpy(pulse_widths) / self.window
        amplitudes = torch.from_numpy(pulse_amplitudes)
        return starts, widths, amplitudes, number_of_pulses, average_width, average_amplitude
def _get_labels ( self , time_window , trace_number ) : dset_p = self . File [ 'Volt_' + str ( trace_number + 1 ) + '/parameters' ] pulses_inside_window = np . where ( ( torch . from_numpy ( dset_p [ 0 , : ] ) > time_window [ 0 ] . cpu ( ) ) & ( torch . from_numpy ( dset_p [ 0 , : ] ) < time_window [ - 1 ] . cpu ( ) ) ) [ 0 ] pulses_inside_window = pulses_inside_window . tolist ( ) start_times = dset_p [ 0 , pulses_inside_window ] pulse_widths = dset_p [ 2 , pulses_inside_window ] pulse_amplitudes = dset_p [ 3 , pulses_inside_window ] number_of_pulses = len ( pulses_inside_window ) if number_of_pulses == 0 : average_width = 0.0 average_amplitude = 0.0 else : average_width = np . average ( pulse_widths ) average_amplitude = np . average ( pulse_amplitudes ) starts = ( torch . from_numpy ( start_times ) - time_window [ 0 ] . cpu ( ) ) / self . window widths = torch . from_numpy ( pulse_widths ) / self . window amplitudes = torch . from_numpy ( pulse_amplitudes ) return starts , widths , amplitudes , number_of_pulses , average_width , average_amplitude
Returns classes and bboxes inside the signal window
Returns classes and bboxes inside the signal window
"Returns classes and bboxes inside the signal window" #pulse_widths = dset_p[1,pulses_inside_window] #pulse_categories = dset_p[2,pulses_inside_window]
self
time_window
trace_number