-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow.py
61 lines (52 loc) · 1.66 KB
/
workflow.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 16 15:26:08 2016
@author: iv1
"""
import datetime
import os
root = os.getcwd()
libdir = r'/home/tyler/Code/Python'
os.chdir(libdir)
import simsdata
os.chdir(root)
verbose = True
#%%
#print('start time = %s'%(str(timestamps['start'])))
if __name__ == '__main__':
cores = 1
#Path to file and prefix
path = r'/home/tyler/Documents/Work/Ovchinnikova/hackathon test data'
prefix = '003 posions dark 0v'
#Initialize converter class
if verbose:
print('Initializing data handler...')
sims_data = simsdata.SIMSdata()
#sims_data.load_h5(h5_path)
#Load SIMS measurement data from raw datafile
if verbose:
print('Loading raw data...')
sims_data.load_raw(path, prefix)
#Preparing SIMS conversion model
if verbose:
print('Intiailizing data converter...')
model = simsdata.SIMSmodel(xy_bins=1, z_bins=5, counts_threshold=0.01, tof_resolution=64,cores=4,chunk_size=1e6) #Minimal overhead
model.convert_all_peaks()
#model.enable_shift_correction()
if verbose:
print('Converting data...')
data2d = sims_data.convert_data('all', model, cores)
# if verbose:
# print('Loading converted data...')
# sims_data.load_converted_data(1)
# if verbose:
# print('Calculating PCA...')
# sims_data.PCA(comp_num=20, spatial_range=(slice(30), -1, -1))
# if verbose:
# print('Calculating NMF...')
# sims_data.NMF(20)
#Plotting averaged data
#sims_data.plot_ave_data()
if verbose:
print('Finished converting, closing model.')
sims_data.close()