Skip to content

Commit 18311d1

Browse files
committed
fmt
1 parent 0975abd commit 18311d1

File tree

3 files changed

+87
-9
lines changed

3 files changed

+87
-9
lines changed

pyproject.toml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
[tool.pyright]
3+
typeCheckingMode = "basic" # or "strict" for stricter checking
4+
pythonVersion = "3.12" # specify your Python version
5+
exclude = ["**/node_modules", "**/__pycache__"]
6+
reportMissingImports = true
7+
reportMissingTypeStubs = false
8+
9+
[tool.ruff]
10+
# Same as Black
11+
line-length = 88
12+
indent-width = 4
13+
14+
# Enable specific rules
15+
select = [
16+
"E", # pycodestyle errors
17+
"F", # pyflakes
18+
"I", # isort
19+
"UP", # pyupgrade
20+
"B", # flake8-bugbear
21+
]
22+
23+
# Ignore specific rules
24+
ignore = [
25+
"E501" # Line too long (handled by formatter)
26+
]
27+
28+
# Exclude files/directories
29+
exclude = [
30+
".git",
31+
".venv",
32+
"__pycache__",
33+
]
34+
35+
[tool.ruff.format]
36+
quote-style = "double"
37+
indent-style = "space"
38+
skip-magic-trailing-comma = false
39+
line-ending-style = "minimal"

ruby.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ def lorentz(x, gamma):
2929

3030

3131
def gauss(x, sigma):
32-
return (np.exp(-np.square(x) / 2 / np.square(sigma))) / (sigma * np.sqrt(2 * np.pi))
32+
return (np.exp(-np.square(x) / 2 / np.square(sigma))) / (
33+
sigma * np.sqrt(2 * np.pi)
34+
)
3335

3436

3537
def voigt(x, sigma, gamma):

ruby_fit.py

+45-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
# -*- coding: utf-8 -*-
2-
"""
3-
Created on Mon May 13 16:59:05 2019
1+
"""Created on Mon May 13 16:59:05 2019
42
53
@author: Hezy
64
"""
75

86
import glob
9-
import numpy as np
7+
108
import matplotlib.pyplot as plt
9+
import numpy as np
1110
from pandas import read_csv
1211
from scipy.optimize import curve_fit
1312

@@ -58,7 +57,9 @@ def pressure(wl):
5857
# read data from csv file
5958
files = glob.glob("./*.txt")
6059
for file in sorted(files):
61-
data = read_csv(file, skiprows=5, header=None, sep="\t", lineterminator="\n")
60+
data = read_csv(
61+
file, skiprows=5, header=None, sep="\t", lineterminator="\n"
62+
)
6263
x = data.iloc[:, 0]
6364
y = data.iloc[:, 1]
6465

@@ -72,10 +73,46 @@ def pressure(wl):
7273
ruby,
7374
x,
7475
y,
75-
p0=(wl_guess1, 0.62, 0.5, h_guess1, wl_guess2, 0.696, 0.5, h_guess2, 0, 0, 0),
76+
p0=(
77+
wl_guess1,
78+
0.62,
79+
0.5,
80+
h_guess1,
81+
wl_guess2,
82+
0.696,
83+
0.5,
84+
h_guess2,
85+
0,
86+
0,
87+
0,
88+
),
7689
bounds=(
77-
(650, 0.01, 0.01, 0.01, 650, 0.01, 0.01, 0.01, -np.inf, -np.inf, -np.inf),
78-
(720, 30, 1, +np.inf, 720, 30, 1, +np.inf, +np.inf, +np.inf, +np.inf),
90+
(
91+
650,
92+
0.01,
93+
0.01,
94+
0.01,
95+
650,
96+
0.01,
97+
0.01,
98+
0.01,
99+
-np.inf,
100+
-np.inf,
101+
-np.inf,
102+
),
103+
(
104+
720,
105+
30,
106+
1,
107+
+np.inf,
108+
720,
109+
30,
110+
1,
111+
+np.inf,
112+
+np.inf,
113+
+np.inf,
114+
+np.inf,
115+
),
79116
),
80117
)
81118
perr = np.sqrt(np.diag(pcov))

0 commit comments

Comments
 (0)