Beispiel #1
0
Module for reading and parsing specifications file for FRET data assimilation.

Created by Nirag Kadakia at 9:30 05-18-2018
This work is licensed under the 
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 
International License. 
To view a copy of this license, 
visit http://creativecommons.org/licenses/by-nc-sa/4.0/.
"""

import scipy as sp
import os
from local_methods import def_data_dir
from utils import merge_two_dicts

data_dir = def_data_dir()


def read_specs_file(data_flag, data_dir=data_dir):
    """ 
	Function to read a specifications file.
	
	Module to gather information from specifications file about how a 
	particular 	run is to be performed for FRET fake data generation
	and FRET data assimilation. 
	Specs file should have format .txt and the format is as listed here:

	
	data_var	       nT			        3
	est_var            set_param_bounds     bounds_Tar_3
	est_spec           est_type             VA
Created by Nirag Kadakia at 21:46 10-26-2017
This work is licensed under the 
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 
International License. 
To view a copy of this license, 
visit http://creativecommons.org/licenses/by-nc-sa/4.0/.
"""

import scipy as sp
from local_methods import def_data_dir
from matplotlib import rc
rc('font', **{'family': 'serif', 'serif': ['Computer Modern']})
rc('text', usetex=True)
import matplotlib.pyplot as plt

DATA_DIR = def_data_dir()


def opt_kernel_pred_fig(dt, kernel_length, Tt_PW):

    fig = plt.figure()
    fig.set_size_inches(6, 6)

    plt.subplot(311)
    plt.title(r'Mean subtracted stimulus')
    plt.xlabel(r'Time (s)')
    plt.ylabel(r'$\mu m$')
    plt.xlim(Tt_PW[0], Tt_PW[-1])

    plt.subplot(312)
    plt.title(r'Mean subtracted FRET prediction')
International License. 
To view a copy of this license, visit 
http://creativecommons.org/licenses/by-nc-sa/4.0/.
"""

import os
import sys
sys.path.append('../src')
from local_methods import def_data_dir
from load_data import load_stim_file, load_meas_file
from save_data import save_meas_plots, save_stim_plots
from single_cell_FRET import single_cell_FRET

print 'Plotting stimuli...'

stim_path = '%s/stim' % def_data_dir()
data_flags = []
for (dirpath, dirnames, filenames) in os.walk(stim_path):
    for filename in filenames:
        if filename.endswith('.stim'):
            data_flags.append(os.path.splitext(filename)[0])

for data_flag in data_flags:

    stim_Tt = load_stim_file(data_flag)
    scF = single_cell_FRET()
    scF.Tt = stim_Tt[:, 0]
    scF.stim = stim_Tt[:, 1:]
    save_stim_plots(scF, data_flag)

print 'Plotting measurements...'