示例#1
0
data_sigma = np.std(data_matrix_arrays, axis=0)
data_2sigma = 2 * data_sigma

#make matrix of all processed arrays
relevant_arrays = [
    time_array, default_array, data_mean, data_median, data_sigma, data_2sigma
]
all_relevant_arrays = np.zeros((len(relevant_arrays), num_timepoints))
for i in range(len(relevant_arrays)):
    all_relevant_arrays[i, :] = relevant_arrays[i]

#save numpy matrix in folder with same filename as data-files and new suffix
filename_stddev = input_datafolder + "/" + data_filename + "_stddev.npy"
np.save(filename_stddev, all_relevant_arrays)
if raw_input("Would you like to store results in /hume/? y/n") == "y":
    result_folder = folder.hume_folder() + "results/"
    filename_stddev = result_folder + data_filename + "_stddev%d.npy" % input_index
    np.save(filename_stddev, all_relevant_arrays)

#add comment regarding analysis in README
with open(input_datafolder + '/README.md', 'a') as readmefile:
    readmefile.write('\n')
    readmefile.write("Analyzed " + input_datafolder + '\n')
    readmefile.write(
        "file consists of one %s array with the following arrays:" %
        (all_relevant_arrays.shape, ) + '\n')
    readmefile.write("* Default array (No fudge factor) for " + array_name +
                     '\n')
    readmefile.write("* Mean value for " + array_name + '\n')
    readmefile.write("* Median value for " + array_name + '\n')
    readmefile.write("* one sigma value for " + array_name + '\n')
"""
This script is for picking an experiment on the stornext folder,
get all the adequate results and write them to the results-folder 
in \thesis\
"""
import os
from save_results import save_results
from directory_master import Foldermap
folder = Foldermap()
stornext_folder = folder.stornext_folder()
hume_folder = folder.hume_folder()
results_folder = "latex/thesis/results/"  #direction to thesis-results-folder from /Master/

if __name__ == '__main__':
    #which experiment?
    inventory = dict(enumerate(os.listdir(stornext_folder)))
    question = "Choose the index of the appropriate experiment?\n%s" % (
        inventory)
    response = int(raw_input(question))

    experiment = inventory[response]
    get_directory = stornext_folder + experiment + "/"
    save_directory = hume_folder + results_folder + experiment + "/"

    #which arrays?
    loa_array_strings = []
    #nb_nsm, rate_nsm
    loa_array_strings.append("num_nsm")
    #elem & iso yield+ism
    iso_list = ["Re-185", "Re-187", "Os-187", "Os-188", "Os-186", "W-184"]
    elem_list = ["Re", "Os", "W"]
"""
Go through /stornext/-directories and plot various data-sets
with mean + regions and such.
Decide which data is to be stored in /results/
"""
from directory_master import Foldermap
from plot_data_files import plot_all_mean_sigma_extrema, plot_all_time_hist
import matplotlib.pyplot as pl

#Get relevant directory-names for uio-systems
folder_instance = Foldermap()
dir_stornext = folder_instance.stornext_folder()
dir_hume = folder_instance.hume_folder()

#decide on variables to plot!
loa_elem = ["Re", "Os"]
loa_re_isos = ["Re-187", "Re-185"]
loa_os_isos = ["Os-187", "Os-188"]
loa_ism_isos = ["ism_iso_" + iso for iso in loa_re_isos + loa_os_isos]
loa_ism_elem = ["ism_elem_" + elem for elem in loa_elem]
loa_yield_isos = ["yield_" + iso for iso in loa_re_isos + loa_os_isos]
loa_array_strings = ["num_nsm", "m_locked"] + \
                    loa_ism_elem + \
                    loa_ism_isos + \
                    loa_yield_isos

if __name__ == '__main__':
    print "Plotting data for the following arrays:"
    print loa_array_strings

    dir_experiment = dir_stornext + "MCExperiment1/"