Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/python-package-conda.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:
- repo: https://github.com/psf/black
rev: 24.10.0 # Replace by any tag/version: https://github.com/psf/black/tags
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
args: ["--line-length", "99"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: no-commit-to-branch
args: [-b master]

default_language_version:
python: python3
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
Jin Group Tools for handling a variety of common data.
Builds upon the WrightTools Data object.


## Installation

Basic:

`pip install git+https://github.com/wright-group/makeitwright.git`

iontof support is considered optional; if you need to use iontof data, use

`pip install git+https://github.com/wright-group/makeitwright.git[iontof]`


## Features

- a module for each instrument featured
- AFM
- AFM (Gwiddion)
- Andor Neo Camera (Solis)
- Becker and Hickl SPCM
- Horiba LabRAM
- Generic Images
- ion TOF
- XRD (Bruker)
- various data importers to create the WrightTools Data objects.
- preset styles and routines for making quick figures


## Installation

### Basic

`pip install git+https://github.com/wright-group/makeitwright.git`

### IonTOF

support for iontof data is optional; if you need to use iontof data, specify additional imports using:

`pip install git+https://github.com/wright-group/makeitwright.git[iontof]`


## Examples

TODO
19 changes: 11 additions & 8 deletions scripts/AbsProcessing.py → examples/AbsProcessing.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@

# Process Reflectance/Transmittance/Absorbance Data from Wright group
# Process Reflectance/Transmittance/Absorbance Data from Wright group Microscope

import pathlib
import makeitwright.process.andor as andor
from makeitwright.process.helpers import roi
from makeitwright.parsers import parse
from makeitwright.artists import setparams, setdpi
from makeitwright.spectra import plot_spectra as plot
import makeitwright as mw
import matplotlib as mpl


setparams()
setdpi(150)
andor = mw.andor
roi = mw.helpers.roi
parse = mw.parsers.parse
plot = mw.spectra.plot_spectra


mpl.rc(dpi=150)


filepath = pathlib.Path().expanduser().resolve() / "Desktop/Research Data/Wright Table/Original/test"
filename_R = "PEAPbBr4 R"
Expand Down
13 changes: 6 additions & 7 deletions scripts/PLProcessing.py → examples/PLProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
# Process PL Data from Wright group

import pathlib
import makeitwright.process.andor as andor
from makeitwright.process.helpers import roi
from makeitwright.parsers import parse
from makeitwright.artists import setparams, setdpi
from makeitwright.spectra import plot_spectra as plot
import makeitwright as mw


setparams()
setdpi(150)
andor = mw.andor
roi = mw.helpers.roi
parse = mw.parsers.parse
plot = mw.spectra.plot_spectra


filepath = pathlib.Path().expanduser() / "Desktop" / "Research Data" / "Wright Table" / "Original" / "test"
filename = "PEAPbI on FPEASnI PL 77K 4 2 hour wait for cool"
Expand Down
9 changes: 5 additions & 4 deletions scripts/main.py → examples/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import matplotlib as mpl
from pathlib import Path

from makeitwright.process import andor
import makeitwright as mw

from makeitwright.process.helpers import show, roi, set_label
from makeitwright.parsers import parse
from makeitwright.artists import plot
andor = mw.andor
roi = mw.helpers.roi
parse = mw.parsers.parse
plot = mw.artists.plot


user_path = Path().expanduser().resolve()
Expand Down
51 changes: 21 additions & 30 deletions scripts/main2.py → examples/pl_T_R_A.py
Original file line number Diff line number Diff line change
@@ -1,58 +1,49 @@
import pathlib
import numpy as np
import matplotlib.cm as cms
import cmocean.cm as cmo
from scipy.signal import savgol_filter as savgol
from scipy.signal import medfilt2d
from scipy.optimize import curve_fit
from scipy.stats import pearsonr, spearmanr, ttest_ind
import WrightTools as wt
import matplotlib as mpl
import makeitwright as mw

import makeitwright.process.andor as andor
import makeitwright.process.beckerhickl as becker
import makeitwright.process.spectralprofile

from makeitwright.process.helpers import show, roi, norm, set_label
from makeitwright.parsers import parse
from makeitwright.artists import setparams, setdpi
from makeitwright.spectra import plot_spectra as plot
roi = mw.helpers.roi
parse = mw.parsers.parse
andor = mw.andor
becker = mw.beckerhickl
plot = mw.spectra.plot_spectra

setparams()
setdpi(150)
fp = pathlib.Path().expanduser().resolve() / r"Desktop/Research Data/Wright Table/Original"

fp = pathlib.Path().expanduser().resolve() / r"Desktop/Research Data/Wright Table/Original" # filepath name to folder
# set plotting parameters
mpl.rcParams['font.sans-serif'] = "Arial"
mpl.rcParams['font.family'] = "sans-serif"
mpl.rcParams['font.size'] = 14
mpl.rcParams['figure.dpi'] = 300
mpl.rcParams['lines.linewidth'] = 4
mpl.rcParams['pcolor.shading'] = 'auto'
mpl.rcParams['figure.dpi'] = 150


#
if True: # Plot PL
data = parse(fp, keywords='4 hr.asc')
#andor.correct_PL_background(data, ybkg=[0, 20])
#y_profile = roi(data, {'wl': ([400, 800], 'sum')}) # If need to check object area
#plot(y_profile)
PL_ROI = roi(data, {'y': ([1021, 1047], 'average')})
plot(PL_ROI, channel=0, xrange=[500, 850])
PL_output = open('C:/Users/kmfor/Desktop/Research Data/Wright Table/Original/4hr.txt', 'w')
PL_output = open(fp / '4hr.txt', 'w')
PL_dataTrace = zip(PL_ROI.axes[0], PL_ROI.channels[0])
for x in PL_dataTrace:
PL_output.write(str(x[0])+'\t')
PL_output.write(str(x[1])+'\n')
PL_output.close()

#
if True: # Plot T/R/A
data = parse('C:/Users/kmfor/Desktop/Research Data/Wright Table/Original/For Chris/23_11_21/4ClPEASnI n1', keywords='Object 3')
data = parse(fp / 'For Chris/23_11_21/4ClPEASnI n1', keywords='Object 3')
R = data[2]
R_back = data[1]
T = data[4]
T_back = data[3]


andor.compute_reflectance(R, R_back, dark_wavelength_range=None)
y_profile = roi(R, {'wl': ([580, 750], 'sum')}) # If need to check object area
plot(y_profile)
plot(R, channel=1, ROI={'y': ([1020, 1070], 'average')}, xrange=[580, 750]) #Currently at 10 x mag
R_ROI = roi(R, {'y': ([1020, 1070], 'average')})
R_output = open('C:/Users/kmfor/Desktop/Research Data/Wright Table/Original/For Chris/23_11_21/4ClPEASnI n1/Object 3 R processed.txt', 'w')
R_output = open(fp / 'For Chris/23_11_21/4ClPEASnI n1/Object 3 R processed.txt', 'w')
R_dataTrace = zip(R_ROI.axes[0], R_ROI.channels[1])
for x in R_dataTrace:
R_output.write(str(x[0])+'\t')
Expand All @@ -64,15 +55,15 @@
# plot(y_profile)
plot(T, channel=1, ROI={'y': ([1020, 1070], 'average')}, xrange=[580, 750]) # Current 10x mag, 100x mag 54-70
T_ROI = roi(T, {'y': ([1020, 1070], 'average')})
T_output = open('C:/Users/kmfor/Desktop/Research Data/Wright Table/Original/For Chris/23_11_21/4ClPEASnI n1/Object 3 T Processed.txt', 'w')
T_output = open(fp / 'For Chris/23_11_21/4ClPEASnI n1/Object 3 T Processed.txt', 'w')
T_dataTrace = zip(T_ROI.axes[0], T_ROI.channels[1])
for x in T_dataTrace:
T_output.write(str(x[0])+'\t')
T_output.write(str(x[1])+'\n')
T_output.close()
#
andor.compute_absorbance(R, T)
A_output = open('C:/Users/kmfor/Desktop/Research Data/Wright Table/Original/For Chris/23_11_21/4ClPEASnI n1/Object 3 A processed.txt', 'w')
A_output = open(fp / 'For Chris/23_11_21/4ClPEASnI n1/Object 3 A processed.txt', 'w')
A_ROI = roi(T, {'y': ([1020, 1070], 'average')}) # A is channel 2 in both R and T data objects
plot(R, channel=2, ROI={'y': ([1020, 1070], 'average')}, xrange=[580, 750]) #Current 10x mag. can add vrange
A_dataTrace = zip(A_ROI.axes[0], A_ROI.channels[2])
Expand Down
12 changes: 11 additions & 1 deletion scripts/workup.py → examples/workup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
from scipy.signal import savgol_filter
from matplotlib import pyplot as plt

import makeitwright as mw


parse = mw.parsers.parse
__at = mw.helpers.find_nearest()
roi = mw.helpers.roi
set_label = mw.helpers.set_label
norm = mw.helpers.norm


def lorentz_fit_2(data, channel='darksub', xrange='all', bounds=None, plot=False):

Expand Down Expand Up @@ -136,6 +145,7 @@ def test2(x, a1, u1, s1, a2, u2, s2):
def residual(a, fit):
return (a-fit)/a*100


base = pathlib.Path().expanduser().resolve() / r'OneDrive/Documents/UW/research/data local/WG-microscope/biexciton-fluence-dependent-PL_20220909'
fn1 = base / "n1BA"
fn2 = base / 'n2BAMA_CRRsample'
Expand Down Expand Up @@ -201,7 +211,7 @@ def residual(a, fit):
wlbkgsub = (d['sig'][:]-wlbkg)/exposure
d.create_channel('constantbkgsub',values=constantbkgsub)
d.create_channel('wlbkgsub',values=wlbkgsub)
set_label(d, 'wlbkgsub', "PL intensity (cps)")
# set_label(d, 'wlbkgsub', "PL intensity (cps)")

bn1 = roi(n1raw,{'y':'sum'})
bn2 = roi(n2raw,{'y':'sum'})
Expand Down
1 change: 1 addition & 0 deletions makeitwright/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
8 changes: 8 additions & 0 deletions makeitwright/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from .__version__ import *
from .core import *

from . import andor
from . import beckerhickl
from . import horiba
from . import iontof
from . import xrd
20 changes: 20 additions & 0 deletions makeitwright/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pathlib


here = pathlib.Path(__file__).resolve().parent


__all__ = ["__version__", "__branch__"]
__version__ = pathlib.Path(here / "VERSION").read_text().strip()

p = here.parent / ".git"
if p.is_file():
with open(str(p)) as f:
p = p.parent / f.readline()[8:].strip() # Strip "gitdir: "
p = p / "HEAD"
if p.exists():
with open(str(p)) as f:
__branch__ = f.readline().rstrip().split(r"/")[-1]
__version__ += "+" + __branch__
else:
__branch__ = None
Loading