#!/usr/bin/env python
""" 
Get the median time points from the 'rates.timeDict.p' file
generated from Sarah's processData.py script.

Inputs:
	rates.timeDict.p (a pickled dictionary)

Outputs:
	median_times output file
   

Ben Ober-Reynolds, boberrey@stanford.edu
20160817
"""

import pandas as pd
import numpy as np
import argparse
import sys

def main():
	################ Parse input parameters ################

	#set up command line argument parser
	parser = argparse.ArgumentParser(description='Script for easily reading a pickled file')
	group = parser.add_argument_group('required arguments')
	group.add_argument('-td', '--time_dict', required=True,
	                    help='The time dict generated by processData.py. Usually has the name "rates.timeDict.p"')
	group = parser.add_argument_group('optional argument')
	group.add_argument('-of','--output_file', default="median_times",
	                    help='The name of the output file. Default is "median_times".')
	if not len(sys.argv) > 1:
		parser.print_help()
		sys.exit()
	#parse command line arguments
	args = parser.parse_args()

	# Read in time dict
	time_dict = pd.read_pickle(args.time_dict)

	# get median times
	median_times = []
	num_timepoints = len(time_dict[time_dict.keys()[0]])

	for i in range(num_timepoints):
		time_values = []
		for key in time_dict.keys():
			time_values.append(float(time_dict[key][i]))
		median_times.append(np.median(time_values))

	# Print data out
	with open(args.output_file+'.txt', 'w') as f:
		for time in median_times:
			f.write('{}\n'.format(time))



if __name__ == '__main__':
    main()
b2eceb539438fb96722361e5a19a79e6a746ebb1
<mask token>

<mask token>


def main():
    parser = argparse.ArgumentParser(description=
        'Script for easily reading a pickled file')
    group = parser.add_argument_group('required arguments')
    group.add_argument('-td', '--time_dict', required=True, help=
        'The time dict generated by processData.py. Usually has the name "rates.timeDict.p"'
        )
    group = parser.add_argument_group('optional argument')
    group.add_argument('-of', '--output_file', default='median_times', help
        ='The name of the output file. Default is "median_times".')
    if not len(sys.argv) > 1:
        parser.print_help()
        sys.exit()
    args = parser.parse_args()
    time_dict = pd.read_pickle(args.time_dict)
    median_times = []
    num_timepoints = len(time_dict[time_dict.keys()[0]])
    for i in range(num_timepoints):
        time_values = []
        for key in time_dict.keys():
            time_values.append(float(time_dict[key][i]))
        median_times.append(np.median(time_values))
    with open(args.output_file + '.txt', 'w') as f:
        for time in median_times:
            f.write('{}\n'.format(time))


<mask token>

<mask token>


def main():
    parser = argparse.ArgumentParser(description=
        'Script for easily reading a pickled file')
    group = parser.add_argument_group('required arguments')
    group.add_argument('-td', '--time_dict', required=True, help=
        'The time dict generated by processData.py. Usually has the name "rates.timeDict.p"'
        )
    group = parser.add_argument_group('optional argument')
    group.add_argument('-of', '--output_file', default='median_times', help
        ='The name of the output file. Default is "median_times".')
    if not len(sys.argv) > 1:
        parser.print_help()
        sys.exit()
    args = parser.parse_args()
    time_dict = pd.read_pickle(args.time_dict)
    median_times = []
    num_timepoints = len(time_dict[time_dict.keys()[0]])
    for i in range(num_timepoints):
        time_values = []
        for key in time_dict.keys():
            time_values.append(float(time_dict[key][i]))
        median_times.append(np.median(time_values))
    with open(args.output_file + '.txt', 'w') as f:
        for time in median_times:
            f.write('{}\n'.format(time))


if __name__ == '__main__':
    main()

<mask token>
import pandas as pd
import numpy as np
import argparse
import sys


def main():
    parser = argparse.ArgumentParser(description=
        'Script for easily reading a pickled file')
    group = parser.add_argument_group('required arguments')
    group.add_argument('-td', '--time_dict', required=True, help=
        'The time dict generated by processData.py. Usually has the name "rates.timeDict.p"'
        )
    group = parser.add_argument_group('optional argument')
    group.add_argument('-of', '--output_file', default='median_times', help
        ='The name of the output file. Default is "median_times".')
    if not len(sys.argv) > 1:
        parser.print_help()
        sys.exit()
    args = parser.parse_args()
    time_dict = pd.read_pickle(args.time_dict)
    median_times = []
    num_timepoints = len(time_dict[time_dict.keys()[0]])
    for i in range(num_timepoints):
        time_values = []
        for key in time_dict.keys():
            time_values.append(float(time_dict[key][i]))
        median_times.append(np.median(time_values))
    with open(args.output_file + '.txt', 'w') as f:
        for time in median_times:
            f.write('{}\n'.format(time))


if __name__ == '__main__':
    main()

#!/usr/bin/env python
""" 
Get the median time points from the 'rates.timeDict.p' file
generated from Sarah's processData.py script.

Inputs:
	rates.timeDict.p (a pickled dictionary)

Outputs:
	median_times output file
   

Ben Ober-Reynolds, boberrey@stanford.edu
20160817
"""

import pandas as pd
import numpy as np
import argparse
import sys

def main():
	################ Parse input parameters ################

	#set up command line argument parser
	parser = argparse.ArgumentParser(description='Script for easily reading a pickled file')
	group = parser.add_argument_group('required arguments')
	group.add_argument('-td', '--time_dict', required=True,
	                    help='The time dict generated by processData.py. Usually has the name "rates.timeDict.p"')
	group = parser.add_argument_group('optional argument')
	group.add_argument('-of','--output_file', default="median_times",
	                    help='The name of the output file. Default is "median_times".')
	if not len(sys.argv) > 1:
		parser.print_help()
		sys.exit()
	#parse command line arguments
	args = parser.parse_args()

	# Read in time dict
	time_dict = pd.read_pickle(args.time_dict)

	# get median times
	median_times = []
	num_timepoints = len(time_dict[time_dict.keys()[0]])

	for i in range(num_timepoints):
		time_values = []
		for key in time_dict.keys():
			time_values.append(float(time_dict[key][i]))
		median_times.append(np.median(time_values))

	# Print data out
	with open(args.output_file+'.txt', 'w') as f:
		for time in median_times:
			f.write('{}\n'.format(time))



if __name__ == '__main__':
    main()