def test2(): seg = neo.Spike2IO(filename='Rat9_11_08_21_10-00-00.SMR').read_segment() #~ seg = neo.Spike2IO(filename = 'R28-C4-B.SMR').read_segment() #~ seg = neo.MicromedIO(filename = 'EEG_1503.TRC').read_segment() app = QApplication([]) w1 = SegmentViewer(segment=seg, xsize=15) w1.show() app.exec_()
def read_laser_file(filepath, neo_version_check): filename = os.path.basename(filepath) file_extension = filename.split('.') [-1] ## Depending on the file extension, the laser information is stored differently if file_extension == 'smrx': if not neo_version_check: enforce_neo_version_satisfaction() neo_version_check = True neo_obj = neo.CedIO(filepath) analogsignals = read_neo_file_return_analogsignals(filename, neo_obj) # keep the signal as a 16 bit float laser_series = np.float16(analogsignals[1]) # the laser information is stored as the second analog signal else: neo_obj = neo.Spike2IO(filepath) analogsignals = read_neo_file_return_analogsignals(filename, neo_obj) # keep the signal as a 16 bit float laser_series = np.float16(analogsignals[1][:,1]) # the laser information is stored as the second column in the # the second analog signal return laser_series
CLI = argparse.ArgumentParser() CLI.add_argument("--output", nargs='?', type=str) CLI.add_argument("--data", nargs='?', type=str) CLI.add_argument("--electrode_location", type=str, nargs='+') CLI.add_argument("--electrode_color", type=str, nargs='+') CLI.add_argument("--annotation_name", type=str) CLI.add_argument("--coordiantes", type=str, nargs='+') CLI.add_argument("--grid_size", type=int, nargs='+') args = CLI.parse_args() electrode_location = str2dict(args.electrode_location) electrode_color = str2dict(args.electrode_color) electrode_coords = str2dict(args.coordiantes) io = neo.Spike2IO(args.data) segment = io.read_segment() segment = enrich(segment, grid_size=args.grid_size, electrode_location=electrode_location, electrode_color=electrode_color, electrode_coordinates=electrode_coords, annotation_name=args.annotation_name, file_origin=args.data) data_dir = os.path.dirname(args.output) if not os.path.exists(data_dir): os.makedirs(data_dir)
def __init__(self, file): reader = neo.Spike2IO(filename=file).read()[0] # 1 block, 1 segment segment = reader.segments[0] self.signals = segment.analogsignals self.event_times = segment.events[0].times