예제 #1
0
def igor_to_pandas(path_to_file):
    '''This function opens an igor binary file (.ibw), extracts the time
    series data, and returns a pandas DataFrame'''

    data_raw = IgorIO(filename=path_to_file)
    data_neo = data_raw.read_block()
    data_neo_array = data_neo.segments[0].analogsignals[0]
    data_df = pd.DataFrame(data_neo_array.as_array().squeeze())

    return data_df
def igor_to_pandas(file, data_dir):
    '''This function opens an igor binary file (.ibw), extracts the time
    series data, and returns a pandas DataFrame'''

    file_path = os.path.join(data_dir, file)
    data_raw = IgorIO(filename=file_path)
    data_neo = data_raw.read_block()
    data_neo_array = data_neo.segments[0].analogsignals[0]
    data_df = pd.DataFrame(data_neo_array.as_array())

    return data_df
예제 #3
0
def neo_IO_function(fullPath_read, out_format, out_folder, file_i=0):

    input_format = ''
    file_header = {}

    # Open and Read the file, add more here if needed
    if fullPath_read.lower().endswith("abf"):
        r = AxonIO(filename=fullPath_read)
        input_format = "abf"
        try:
            file_header = r.read_header()
        except AttributeError:
            pass
    elif fullPath_read.lower().endswith("wcp"):
        r = WinWcpIO(filename=fullPath_read)
        input_format = "wcp"
        file_header = process_winwcp_header.read_bin_header(fullPath_read)
    elif fullPath_read.lower().endswith("ibw"):
        r = IgorIO(filename=fullPath_read)
        input_format = "ibw"
        file_header = process_igor_header.get_header_dict(fullPath_read)

    bl = r.read_block(
        lazy=False,
        cascade=True,
    )

    if len(bl.segments) > 1:
        zfill_max_int = int(ceil(log10(len(bl.segments))) + 1)

    # Iterate through each segment and analogsignal list
    for i in range(0, len(bl.segments)):
        folderName, tail_name = path.split(fullPath_read)
        fileName = path.splitext(path.basename(fullPath_read))[0]

        if len(bl.segments) <= 1:
            txtFileName = fileName + out_format
        else:
            txtFileName = fileName + "_" + str(i + 1).zfill(
                zfill_max_int) + out_format

        fullPathtxt = path.join(folderName, out_folder, txtFileName)
        analogSignals = bl.segments[i].analogsignals

        write_ATF(analogSignals, fullPathtxt, file_header, input_format,
                  tail_name)

        print("Wrote {} to {}".format(tail_name, txtFileName))
        file_i += 1
        yield file_i
예제 #4
0
def open_data(path):
    """Take a 'path' to an .ibw file and returns a neo.core.AnalogSignal."""
    igor_io = IgorIO(filename=path)
    analog_signal = igor_io.read_analogsignal()
    return analog_signal
예제 #5
0
파일: bbp.py 프로젝트: JustasB/neuronunit
def open_data(path):
    """Take a 'path' to an .ibw file and returns a neo.core.AnalogSignal."""

    igor_io = IgorIO(filename=path)
    analog_signal = igor_io.read_analogsignal()
    return analog_signal
예제 #6
0
    condition = 'TTX+4-AP'
else:
    condition = 'control'

# %%
'''
This cell sorts through the cell_id directory and sorts files only noise vm
files into two lits; 1 for drugs and 1 for contorl. Then it opens the correct
file type for the given file_name, and concatenates vm traces if necessary.
Open igor binary file into neo, read neo.block, convert to np.array, convert
to pd.dataframe, concat with empty data frame noise_vmdf and repeat if concat.
'''
os.chdir('../ETC/Data/')

currdf = pd.DataFrame()
temp_curr_raw = IgorIO(filename=file_name)
temp_curr_neo = temp_curr_raw.read_block()
temp_currarray = temp_curr_neo.segments[0].analogsignals[0]
temp_currdf = pd.DataFrame(temp_currarray.as_array())
currdf = pd.concat([currdf, temp_currdf], axis=1)
temp_noise_vm_raw = None
temp_noise_vm_block = None
temp_noise_vmarray = None
os.chdir('../..')

for item in depolarized_sweeps:
    noise_vmdf[item] = np.nan
# %%
'''
#Plot all the traces on one plot
plt.figure()