Basic PEMtk fitting class demo
01/09/22
Outline of this notebook:
Load required packages.
Setup pemtkFit object.
Set various parameters, either from existing data or new values.
Data is handled as a set of dictionaries within the class,
self.data[key][dataType]
, wherekey
is an arbitrary label for, e.g. a specific experiment, calculation etc, anddataType
contains a set of values, parameters etc. (Should become clear below!)Methods operate on all
self.data
items in general, with some special cases:self.data['subset']
contains data to be used in fitting.
Simulate data
Use ePSproc to simulated aligned-frame measurements.
Fit data (serial version)
For batch and parallel fitting see the multi-fit demo notebook
Prerequisities
Working installation of ePSproc + PEMtk (or local copies of the Git repos, which can be pointed at for setup below).
Test/demo data, from ePSproc Github repo.
Setup
Imports
A few standard imports…
[1]:
import sys
import os
from pathlib import Path
# import numpy as np
# import epsproc as ep
# import xarray as xr
from datetime import datetime as dt
timeString = dt.now()
And local module imports. This should work either for installed versions (e.g. via pip install
), or for test code via setting the base path below to point at your local copies.
[2]:
# For module testing, include path to module here, otherwise use global installation
if sys.platform == "win32":
modPath = Path(r'D:\code\github') # Win test machine
winFlag = True
else:
modPath = Path(r'/home/femtolab/github') # Linux test machine
winFlag = False
# Append to sys path
sys.path.append((modPath/'ePSproc').as_posix())
sys.path.append((modPath/'PEMtk').as_posix())
[3]:
# ePSproc
import epsproc as ep
# Set data path
# Note this is set here from ep.__path__, but may not be correct in all cases - depends on where the Github repo is.
epDemoDataPath = Path(ep.__path__[0]).parent/'data'