Skip to content

Commit

Permalink
STY: update pre-commit version and apply relevant fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrakitin committed Apr 29, 2024
1 parent 9f9d6f6 commit df49fc7
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 20 deletions.
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
exclude: '(v2)/.*'
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/ambv/black
rev: 23.1.0
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/kynan/nbstripout
rev: 0.6.1
rev: 0.7.1
hooks:
- id: nbstripout
1 change: 1 addition & 0 deletions pyCHX/Badpixels.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Dev@Octo12,2017"""

import numpy as np

damaged_4Mpixel = np.array(
Expand Down
1 change: 0 additions & 1 deletion pyCHX/Create_Report.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def add_image_string(


class create_pdf_report(object):

"""Aug 16, YG@CHX-NSLS-II
Create a pdf report by giving data_dir, uid, out_dir
data_dir: the input data directory, including all necessary images
Expand Down
13 changes: 5 additions & 8 deletions pyCHX/chx_Fitters2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ def gauss_func(x, xc, amp, sigma, baseline):


def gauss2D_func(x, y, xc, amp, sigmax, yc, sigmay, baseline):
return (
amp * np.exp(-((x - xc) ** 2) / 2.0 / sigmax**2) * np.exp(-((y - yc) ** 2) / 2.0 / sigmay**2)
+ baseline
)
return amp * np.exp(-((x - xc) ** 2) / 2.0 / sigmax**2) * np.exp(-((y - yc) ** 2) / 2.0 / sigmay**2) + baseline


def extract_param(bestfits, key):
Expand Down Expand Up @@ -75,7 +72,7 @@ def __call__(self, x, y, vx, vy, **kwargs):

# make the parameters from the kwargs
for key in self.params.keys():
if key in kwargs.keys() and key is not "XY":
if key in kwargs.keys() and key != "XY":
params[key].value = kwargs[key]
else:
# then guess
Expand Down Expand Up @@ -142,7 +139,7 @@ def guess(self, **kwargs):

if kwargs is not None:
for key in kwargs.keys():
if key in paramsdict and key is not "xy":
if key in paramsdict and key != "xy":
paramsdict[key] = kwargs[key]

return paramsdict
Expand Down Expand Up @@ -189,7 +186,7 @@ def __call__(self, XY, img, **kwargs):

# make the parameters from the kwargs
for key in self.params.keys():
if key in kwargs.keys() and key is not "XY":
if key in kwargs.keys() and key != "XY":
params[key].value = kwargs[key]
else:
# then guess
Expand Down Expand Up @@ -334,7 +331,7 @@ def guess(self, img, XY=None, **kwargs):
paramsdict["sigmay"] = 1
# print( paramsdict )
for key in kwargs.keys():
if key in paramsdict and key is not "xy":
if key in paramsdict and key != "xy":
paramsdict[key] = kwargs[key]
# print( paramsdict )
return paramsdict
1 change: 0 additions & 1 deletion pyCHX/chx_correlationc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This module is for computation of time correlation by using compressing algorithm
"""


from __future__ import absolute_import, division, print_function

import logging
Expand Down
1 change: 1 addition & 0 deletions pyCHX/chx_correlationp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[email protected]
This module is for parallel computation of time correlation
"""

from __future__ import absolute_import, division, print_function

import logging
Expand Down
1 change: 1 addition & 0 deletions pyCHX/chx_correlationp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Feb 20, 2018
The chx_correlationp2 is for dedug g2
"""

from __future__ import absolute_import, division, print_function

import logging
Expand Down
1 change: 1 addition & 0 deletions pyCHX/chx_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[email protected]
This module is for the necessary packages for the XPCS analysis
"""

## Import all the required packages for Data Analysis
from databroker import Broker
from databroker.assets.path_only_handlers import RawHandler
Expand Down
4 changes: 1 addition & 3 deletions pyCHX/chx_speckle.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,7 @@ def fit_xsvs1(

# print ( rois )
if func == "bn":
result = mod.fit(
spe_cts_all[j, i][rois], bin_values=bin_edges[j, i][:-1][rois], K=5 * 2**j, M=12
)
result = mod.fit(spe_cts_all[j, i][rois], bin_values=bin_edges[j, i][:-1][rois], K=5 * 2**j, M=12)
elif func == "gm":
result = mod.fit(
spe_cts_all[j, i][rois], bin_values=bin_edges[j, i][:-1][rois], K=K_mean[i] * 2**j, M=20
Expand Down
4 changes: 1 addition & 3 deletions pyCHX/chx_specklecp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1778,9 +1778,7 @@ def fit_xsvs1(

# print ( rois )
if func == "bn":
result = mod.fit(
spe_cts_all[j, i][rois], bin_values=bin_edges[j, i][:-1][rois], K=5 * 2**j, M=12
)
result = mod.fit(spe_cts_all[j, i][rois], bin_values=bin_edges[j, i][:-1][rois], K=5 * 2**j, M=12)
elif func == "gm":
result = mod.fit(
spe_cts_all[j, i][rois], bin_values=bin_edges[j, i][:-1][rois], K=K_mean[i] * 2**j, M=20
Expand Down

0 comments on commit df49fc7

Please sign in to comment.