Welcome to ShgPy!¶
What is ShgPy?¶
ShgPy is a simple toolkit for analyzing rotational-anisotropy second harmonic generation (RA-SHG) data. It depends mainly on three packages, NumPy, SciPy, and SymPy – as well as (optionally) Matplolib for some basic plotting capability – to simulate, manipulate, and fit RA-SHG data in a (hopefully!) intuitive way.
Fitting RA-SHG data involves solving a complex global minimization problem with many degrees of freedom. Moreover, the fitting functions naively involve a degree of complexity due to the trigonometric nature of the problem. This software therefore takes a dual approach to fitting RA-SHG data – first of all, all of the fits are done in Fourier space, which significantly reduces the complexity of the fitting formulas, and second of all, ShgPy makes heavy use of the scipy.optimize.basinhopping algorithm, which is particularly useful for these types of global optimization problems. In some ways, ShgPy is just a wrapper around scipy.optimize.
What ShgPy is not¶
Right now, ShgPy is narrowly suited for a particular RA-SHG geometry (i.e. this one). Other implementations of RA-SHG (e.g. where the angle of incidence can vary, etc.) are not currently supported. However, this software is always evolving and support may come in the future if there’s enough interest (see how to contribute).
Installation¶
Installation of ShgPy is easy! Just install the shgpy
package:
$ pip install shgpy
You’ll also need to install numpy
, scipy
, sympy
, and, optionally, matplotlib
; refer to the corresponding documentation for more information about these packages. Additionally, you’ll need a working installation of gcc
.
Getting started¶
After installing ShgPy, familiarize yourself with the basic routines by reading the tutorials and FAQs.
To follow along, you’ll want to download the example files.
Documentation¶
For further details, consult the auto-generated API documentation:
- Documentation
- shgpy.core.data_handler module
DataContainer
DataContainer.as_pandas()
DataContainer.copy()
DataContainer.filter()
DataContainer.get_items()
DataContainer.get_keys()
DataContainer.get_maxval()
DataContainer.get_minval()
DataContainer.get_offset()
DataContainer.get_pc()
DataContainer.get_pc_maxval()
DataContainer.get_pc_minval()
DataContainer.get_phase_shift()
DataContainer.get_scale()
DataContainer.get_values()
DataContainer.normalize_data()
DataContainer.phase_shift_data()
DataContainer.scale_data()
DataContainer.subtract_min()
FormContainer
FormContainer.apply_arbitrary_scale()
FormContainer.apply_phase_shift()
FormContainer.as_pandas()
FormContainer.copy()
FormContainer.expand()
FormContainer.get_free_symbols()
FormContainer.get_items()
FormContainer.get_keys()
FormContainer.get_pc()
FormContainer.get_values()
FormContainer.simplify()
FormContainer.subs()
dat_add()
dat_subtract()
dat_to_fdat()
fDataContainer
fDataContainer.as_pandas()
fDataContainer.copy()
fDataContainer.get_M()
fDataContainer.get_items()
fDataContainer.get_keys()
fDataContainer.get_maxval()
fDataContainer.get_pc()
fDataContainer.get_pc_maxval()
fDataContainer.get_phase_shift()
fDataContainer.get_scale()
fDataContainer.get_values()
fDataContainer.normalize_fdata()
fDataContainer.phase_shift_fdata()
fDataContainer.scale_fdata()
fFormContainer
fFormContainer.apply_arbitrary_scale()
fFormContainer.apply_phase_shift()
fFormContainer.as_pandas()
fFormContainer.copy()
fFormContainer.get_M()
fFormContainer.get_free_symbols()
fFormContainer.get_items()
fFormContainer.get_keys()
fFormContainer.get_pc()
fFormContainer.get_values()
fFormContainer.subs()
fdat_to_dat()
fform_to_dat()
fform_to_fdat()
fform_to_form()
form_to_dat()
form_to_fdat()
form_to_fform()
load_data()
load_data_and_dark_subtract()
load_data_and_fourier_transform()
load_fform()
merge_containers()
n2i()
read_csv()
save_fform()
- shgpy.core.utilities module
- shgpy.fformfit module
- shgpy.fformgen module
- shgpy.formgen module
- shgpy.plotter module
- shgpy.shg_symbols module
Fx
Fy
Fz
phi
psi
sxxx
sxxy
sxxz
sxyx
sxyy
sxyz
sxzx
sxzy
sxzz
syxx
syxy
syxz
syyx
syyy
syyz
syzx
syzy
syzz
szxx
szxy
szxz
szyx
szyy
szyz
szzx
szzy
szzz
theta
xxx
xxxx
xxxy
xxxz
xxy
xxyx
xxyy
xxyz
xxz
xxzx
xxzy
xxzz
xyx
xyxx
xyxy
xyxz
xyy
xyyx
xyyy
xyyz
xyz
xyzx
xyzy
xyzz
xzx
xzxx
xzxy
xzxz
xzy
xzyx
xzyy
xzyz
xzz
xzzx
xzzy
xzzz
yxx
yxxx
yxxy
yxxz
yxy
yxyx
yxyy
yxyz
yxz
yxzx
yxzy
yxzz
yyx
yyxx
yyxy
yyxz
yyy
yyyx
yyyy
yyyz
yyz
yyzx
yyzy
yyzz
yzx
yzxx
yzxy
yzxz
yzy
yzyx
yzyy
yzyz
yzz
yzzx
yzzy
yzzz
zxx
zxxx
zxxy
zxxz
zxy
zxyx
zxyy
zxyz
zxz
zxzx
zxzy
zxzz
zyx
zyxx
zyxy
zyxz
zyy
zyyx
zyyy
zyyz
zyz
zyzx
zyzy
zyzz
zzx
zzxx
zzxy
zzxz
zzy
zzyx
zzyy
zzyz
zzz
zzzx
zzzy
zzzz
- shgpy.tensor_definitions module
- shgpy.core.data_handler module
How to contribute¶
See how to contribute.
Cite this software¶
If you use ShgPy in your project, please let me know! I’m interested to see who is using this software and in what form.
To cite this software in a publication, use
Bryan Fichera. ShgPy. https://bfichera.github.io/shgpy/, 2020. doi:10.5281/zenodo.3873755
Alternatively, use the following BibTex entry:
@misc{shgpy,
author = {Bryan Fichera},
title = {Shg{P}y},
year = {2020},
howpublished = {\url{https://bfichera.github.io/shgpy/}},
doi = {10.5281/zenodo.3873755}
}
Contact me¶
Other questions or concerns? Please contact me!