Commit 9bff0fee authored by Unknown's avatar Unknown
Browse files

BE processing notebook update

parent 9d6383a4
...@@ -58,12 +58,12 @@ ...@@ -58,12 +58,12 @@
This notebook performs some functional fitting whose duration can be substantially decreased by using more memory and CPU cores. We have provided default values below but you may choose to change them if necessary. This notebook performs some functional fitting whose duration can be substantially decreased by using more memory and CPU cores. We have provided default values below but you may choose to change them if necessary.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
max_mem = 1024*2 # Maximum memory to use, in Mbs. Default = 1024 max_mem = 1024*8 # Maximum memory to use, in Mbs. Default = 1024
max_cores = 2 # Number of logical cores to use in fitting. None uses all but 2 available cores. max_cores = None # Number of logical cores to use in fitting. None uses all but 2 available cores.
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Make the data pycroscopy compatible ## Make the data pycroscopy compatible
...@@ -88,18 +88,10 @@ ...@@ -88,18 +88,10 @@
file_filter='Parameters for raw BE data (*.txt *.mat *xls *.xlsx);; \ file_filter='Parameters for raw BE data (*.txt *.mat *xls *.xlsx);; \
Translated file (*.h5)') Translated file (*.h5)')
(data_dir, filename) = os.path.split(input_file_path) (data_dir, filename) = os.path.split(input_file_path)
if copy_input_file:
_, ext = os.path.splitext(filename)
temp_path = os.path.join(data_dir, 'temp_file'+ext)
if os.path.exists(temp_path):
os.remove(temp_path)
shutil.copy2(input_file_path, temp_path)
input_file_path = temp_path
if input_file_path.endswith('.h5'): if input_file_path.endswith('.h5'):
# No translation here # No translation here
h5_path = input_file_path h5_path = input_file_path
force = False # Set this to true to force patching of the datafile. force = False # Set this to true to force patching of the datafile.
tl = px.LabViewH5Patcher() tl = px.LabViewH5Patcher()
...@@ -194,20 +186,20 @@ ...@@ -194,20 +186,20 @@
h5_sho_group = px.hdf_utils.findH5group(h5_main, 'SHO_Fit') h5_sho_group = px.hdf_utils.findH5group(h5_main, 'SHO_Fit')
sho_fitter = px.BESHOmodel(h5_main, parallel=True) sho_fitter = px.BESHOmodel(h5_main, parallel=True)
if len(h5_sho_group) == 0: if len(h5_sho_group) == 0:
print('No SHO fit found. Doing SHO Fitting now') print('No SHO fit found. Doing SHO Fitting now')
h5_sho_guess = sho_fitter.do_guess(strategy='complex_gaussian', processors=max_cores, options={'num_points':sho_fit_points}) h5_sho_guess = sho_fitter.do_guess(strategy='complex_gaussian', processors=max_cores, max_mem=max_mem, options={'num_points':sho_fit_points})
h5_sho_fit = sho_fitter.do_fit(processors=max_cores) h5_sho_fit = sho_fitter.do_fit(processors=max_cores, max_mem=max_mem)
else: else:
print('Taking previous SHO results already present in file') print('Taking previous SHO results already present in file')
h5_sho_guess = h5_sho_group[-1]['Guess'] h5_sho_guess = h5_sho_group[-1]['Guess']
try: try:
h5_sho_fit = h5_sho_group[-1]['Fit'] h5_sho_fit = h5_sho_group[-1]['Fit']
except KeyError: except KeyError:
print('Previously computed guess found. Now computing fit') print('Previously computed guess found. Now computing fit')
h5_sho_fit = sho_fitter.do_fit(processors=max_cores, h5_guess=h5_sho_guess) h5_sho_fit = sho_fitter.do_fit(processors=max_cores, max_mem=max_mem, h5_guess=h5_sho_guess)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## Visualize the SHO results ## Visualize the SHO results
...@@ -376,11 +368,10 @@ ...@@ -376,11 +368,10 @@
``` python ``` python
map_parm = 'Work of Switching' map_parm = 'Work of Switching'
plot_cycle = 0 plot_cycle = 0
plot_position = (int(pos_dims[0]/2), int(pos_dims[1]/2)) plot_position = (int(pos_dims[0]/2), int(pos_dims[1]/2))
plot_bias_step = 0 plot_bias_step = 0
h5_main.pos_dim_sizes
px.viz.be_viz_utils.plot_loop_sho_raw_comparison(h5_loop_parameters, map_parm, plot_cycle, plot_position, plot_bias_step) px.viz.be_viz_utils.plot_loop_sho_raw_comparison(h5_loop_parameters, map_parm, plot_cycle, plot_position, plot_bias_step)
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
...@@ -391,7 +382,7 @@ ...@@ -391,7 +382,7 @@
* Finally consider saving this notebook if necessary * Finally consider saving this notebook if necessary
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
hdf.close() # hdf.close()
``` ```
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment