-
Notifications
You must be signed in to change notification settings - Fork 0
/
workflow_nuclear.py
58 lines (50 loc) · 1.65 KB
/
workflow_nuclear.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
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 16 15:26:08 2016
@author: iv1
"""
import datetime
#%%This code won’t work from Python console
#!!! Clean import procedure with __init__.py file etc.
from SIMSmodel import SIMSmodel
from SIMSdata import SIMSdata
verbose = True
#%%
#print('start time = %s'%(str(timestamps['start'])))
if __name__ == '__main__':
cores = 8
#Path to file and prefix
path = r'/home/cades/data/good_brain/SIMS'
prefix = 'rubber b (rubber b)-#1 of 2-(+)'
#Initialize converter class
if verbose:
print('Initializing data handler...')
sims_data = 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, nuke=True)
#Preparing SIMS conversion model
if verbose:
print('Intiailizing data converter...')
model = SIMSmodel(xy_bins=1, z_bins=1, counts_threshold=0.01, tof_resolution=64) #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()