Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 16, 2024
1 parent d54e4ac commit 62d79e5
Show file tree
Hide file tree
Showing 18 changed files with 253 additions and 255 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ repos:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
}
}
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys

import versioningit

sys.path.insert(0, os.path.abspath("../src"))
Expand Down Expand Up @@ -59,7 +60,9 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "alabaster" # "sphinx_rtd_theme", please add corresponding package to environment.yml if you want to use it
html_theme = (
"alabaster" # "sphinx_rtd_theme", please add corresponding package to environment.yml if you want to use it
)
autosummary_generate = True

# Napoleon settings
Expand Down
473 changes: 237 additions & 236 deletions docs/ex_h5py_NXtas.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions scripts/HoV6Sn6_contour.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import matplotlib.pyplot as plt

from tavi.data.spice_to_nexus import convert_spice_to_nexus
from tavi.data.tavi import TAVI
from tavi.plotter import Plot2DManager
Expand Down
1 change: 1 addition & 0 deletions scripts/test_fit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import matplotlib.pyplot as plt

from tavi.data.fit import Fit
from tavi.data.tavi import TAVI
from tavi.plotter import Plot1DManager
Expand Down
1 change: 1 addition & 0 deletions scripts/test_fit_group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import matplotlib.pyplot as plt

from tavi.data.tavi import TAVI
from tavi.plotter import Plot1DManager, Plot2DManager

Expand Down
2 changes: 1 addition & 1 deletion src/tavi/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import os
import shutil

from configparser import ConfigParser
from pathlib import Path

from mantid.kernel import Logger

logger = Logger("PACKAGENAME")
Expand Down
1 change: 0 additions & 1 deletion src/tavi/data/scan_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ def get_data_from(self, nexus_entry):


def nexus_entry_to_scan(nexus_entry):

def get_string(entry_string):
metadata = data_entry.get(entry_string)
if metadata is not None:
Expand Down
7 changes: 1 addition & 6 deletions src/tavi/data/spice_to_nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def _read_spice_ub(ub_file_name):


def _format_spice_header(headers):

formatted_headers = {}

exp_str = ["scan_title", "users", "local_contact", "experiment"]
Expand Down Expand Up @@ -401,7 +400,6 @@ def _nexus_sample(nxsample, das_logs, sample_config_params=None):
nxsample.attrs["EX_required"] = "true"

try:

nxsample.create_dataset(name="name", data=das_logs.attrs["samplename"], maxshape=None)
nxsample["name"].attrs["type"] = "NX_CHAR"
nxsample["name"].attrs["EX_required"] = "true"
Expand Down Expand Up @@ -672,9 +670,7 @@ def convert_spice_ub_to_nexus(
"""Convert all UBConf files into one NeXus entry named UBConf.h5"""

if verbose:
disp_str = (
f"Converting SPICE UBConf files at {path_to_spice_folder} to an NeXus entry at {path_to_hdf5_folder}"
)
disp_str = f"Converting SPICE UBConf files at {path_to_spice_folder} to an NeXus entry at {path_to_hdf5_folder}"
print(disp_str)

p = Path(path_to_spice_folder)
Expand All @@ -684,7 +680,6 @@ def convert_spice_ub_to_nexus(
ub_conf_dicts = {ub_file.parts[-1].split(".")[0]: _read_spice_ub(ub_file) for ub_file in ub_files_all}

with h5py.File(path_to_hdf5_folder + "UBConf.h5", "w") as root:

for ub_name, ub_data in ub_conf_dicts.items():
ub_entry = root.create_group(ub_name)
ub_entry.attrs["NX_class"] = "NXcollection"
Expand Down
2 changes: 1 addition & 1 deletion src/tavi/instrument/instrument_params/cg4c.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
"v_post_sample": 600,
"v_post_ana": 600
}
}
}
2 changes: 1 addition & 1 deletion src/tavi/instrument/instrument_params/hb1a.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@
"v_post_sample": 600,
"v_post_ana": 600
}
}
}
2 changes: 1 addition & 1 deletion src/tavi/instrument/instrument_params/hb3.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@
"v_post_sample": 300,
"v_post_ana": 600
}
}
}
2 changes: 1 addition & 1 deletion src/tavi/instrument/instrument_params/hb3_mnte.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@
"v_post_sample": 120,
"v_post_ana": 120
}
}
}
2 changes: 1 addition & 1 deletion src/tavi/instrument/instrument_params/takin_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@
"v_post_sample": 30,
"v_post_ana": 30
}
}
}
1 change: 0 additions & 1 deletion src/tavi/instrument/resolution/ellipse_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def generate_plot(self, ax, c="black", linestyle="solid"):
pts = self.generate_ellipse()

if self.grid_helper is None:

s = ax.plot(
pts[0],
pts[1],
Expand Down
1 change: 0 additions & 1 deletion src/tavi/instrument/resolution/ellipsoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def __init__(
sample: Xtal,
projection: Optional[tuple] = ((1, 0, 0), (0, 1, 0), (0, 0, 1)),
) -> None:

self.STATUS: Optional[bool] = None
self.q: Optional[tuple[float, float, float]] = None
self.hkl: tuple[float, float, float] = hkl
Expand Down
2 changes: 1 addition & 1 deletion src/tavi/instrument/tas.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def calculate_ub_matrix(self, peaks: tuple[Peak, ...]):
if not isinstance(self.sample, Xtal):
raise ValueError("sample needs to be Xtal class for UB calculation.")

match (num_of_peaks := len(peaks)):
match num_of_peaks := len(peaks):
case 2:
ubconf = self._find_u_from_two_peaks(peaks)
self.sample.set_orientation(ubconf)
Expand Down

0 comments on commit 62d79e5

Please sign in to comment.