# set up notebook to show plots within the notebook
# set up notebook to show plots within the notebook
%matplotlibnotebook
%matplotlibnotebook
# Make Notebook take up most of page width
# Make Notebook take up most of page width
display(HTML(data="""
display(HTML(data="""
<style>
<style>
div#notebook-container { width: 95%; }
div#notebook-container { width: 95%; }
div#menubar-container { width: 65%; }
div#menubar-container { width: 65%; }
div#maintoolbar-container { width: 99%; }
div#maintoolbar-container { width: 99%; }
</style>
</style>
"""))
"""))
```
```
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Set some basic parameters for computation
## Set some basic parameters for computation
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
Converting the raw data into a pycroscopy compatible hierarchical data format (HDF or .h5) file gives you access to the fast fitting algorithms and powerful analysis functions within pycroscopy
Converting the raw data into a pycroscopy compatible hierarchical data format (HDF or .h5) file gives you access to the fast fitting algorithms and powerful analysis functions within pycroscopy
#### H5 files:
#### H5 files:
* are like smart containers that can store matrices with data, folders to organize these datasets, images, metadata like experimental parameters, links or shortcuts to datasets, etc.
* are like smart containers that can store matrices with data, folders to organize these datasets, images, metadata like experimental parameters, links or shortcuts to datasets, etc.
* are readily compatible with high-performance computing facilities
* are readily compatible with high-performance computing facilities
* scale very efficiently from few kilobytes to several terabytes
* scale very efficiently from few kilobytes to several terabytes
* can be read and modified using any language including Python, Matlab, C/C++, Java, Fortran, Igor Pro, etc.
* can be read and modified using any language including Python, Matlab, C/C++, Java, Fortran, Igor Pro, etc.
#### You can load either of the following:
#### You can load either of the following:
* Any .mat or .txt parameter file from the original experiment
* Any .mat or .txt parameter file from the original experiment
* A .h5 file generated from the raw data using pycroscopy - skips translation
* A .h5 file generated from the raw data using pycroscopy - skips translation
You can select desired file type by choosing the second option in the pull down menu on the bottom right of the file window
You can select desired file type by choosing the second option in the pull down menu on the bottom right of the file window
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
input_file_path=px.io_utils.uiGetFile(caption='Select translated .h5 file or raw experiment data',
input_file_path=px.io_utils.uiGetFile(caption='Select translated .h5 file or raw experiment data',
file_filter='Parameters for raw BE data (*.txt *.mat *xls *.xlsx);; \
file_filter='Parameters for raw BE data (*.txt *.mat *xls *.xlsx);; \
The file contents are stored in a tree structure, just like files on a conventional computer.
The file contents are stored in a tree structure, just like files on a conventional computer.
The data is stored as a 2D matrix (position, spectroscopic value) regardless of the dimensionality of the data. Thus, the positions will be arranged as row0-col0, row0-col1.... row0-colN, row1-col0.... and the data for each position is stored as it was chronologically collected
The data is stored as a 2D matrix (position, spectroscopic value) regardless of the dimensionality of the data. Thus, the positions will be arranged as row0-col0, row0-col1.... row0-colN, row1-col0.... and the data for each position is stored as it was chronologically collected
The main dataset is always accompanied by four ancillary datasets that explain the position and spectroscopic value of any given element in the dataset.
The main dataset is always accompanied by four ancillary datasets that explain the position and spectroscopic value of any given element in the dataset.
%% Cell type:code id: tags:
%% Cell type:code id: tags:
``` python
``` python
print('Datasets and datagroups within the file:\n------------------------------------')
print('Datasets and datagroups within the file:\n------------------------------------')
px.io.hdf_utils.print_tree(hdf.file)
px.io.hdf_utils.print_tree(hdf.file)
print('\nThe main dataset:\n------------------------------------')
print('\nThe main dataset:\n------------------------------------')
Here, we visualize the parameters for the SHO fits. BE-line (3D) data is visualized via simple spatial maps of the SHO parameters while more complex BEPS datasets (4+ dimensions) can be visualized using a simple interactive visualizer below.
Here, we visualize the parameters for the SHO fits. BE-line (3D) data is visualized via simple spatial maps of the SHO parameters while more complex BEPS datasets (4+ dimensions) can be visualized using a simple interactive visualizer below.
You can choose to visualize the guesses for SHO function or the final fit values from the first line of the cell below.
You can choose to visualize the guesses for SHO function or the final fit values from the first line of the cell below.
Use the sliders below to inspect the BE response at any given location.
Use the sliders below to inspect the BE response at any given location.
This is applicable only to DC voltage spectroscopy datasets from BEPS. The PFM hysteresis loops in this dataset will be projected to maximize the loop area and then fitted to a function.
This is applicable only to DC voltage spectroscopy datasets from BEPS. The PFM hysteresis loops in this dataset will be projected to maximize the loop area and then fitted to a function.
Note: This computation generally takes a while for reasonably sized datasets.
Note: This computation generally takes a while for reasonably sized datasets.