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 Jan 13, 2025
1 parent 8655c77 commit e9becb1
Show file tree
Hide file tree
Showing 48 changed files with 70 additions and 89 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class ExecDirective(Directive):
Credit goes to:
https://stackoverflow.com/questions/27875455/displaying-dictionary-data-in-sphinx-documentation/29789910#29789910
"""

has_content = True

def run(self):
Expand Down
6 changes: 3 additions & 3 deletions docs/drtsans/example_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
# files
config["mask"] = "/SNS/EQSANS/shared/NeXusFiles/EQSANS/2017B_mp/beamstop60_mask_4m.nxs"
config["flux"] = "/SNS/EQSANS/shared/instrument_configuration/bl6_flux_at_sample"
config[
"sensitivity_file_path"
] = "/SNS/EQSANS/shared/NeXusFiles/EQSANS/2017A_mp/Sensitivity_patched_thinPMMA_4m_79165_event.nxs"
config["sensitivity_file_path"] = (
"/SNS/EQSANS/shared/NeXusFiles/EQSANS/2017A_mp/Sensitivity_patched_thinPMMA_4m_79165_event.nxs"
)
config["dark_current"] = "/SNS/EQSANS/shared/NeXusFiles/EQSANS/2017B_mp/EQSANS_86275.nxs.h5"

# numeric values
Expand Down
3 changes: 1 addition & 2 deletions notebooks/barscan/biosans_midrange_detector_barscan.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"import time\n",
"\n",
"# Mantid imports\n",
"from mantid.simpleapi import LoadEventNexus, LoadNexusProcessed, SaveNexus, mtd\n",
"from mantid.simpleapi import LoadNexusProcessed, mtd\n",
"\n",
"# drtsans imports\n",
"from drtsans.pixel_calibration import calculate_barscan_calibration, load_calibration, as_intensities\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"import numpy as np\n",
"import os\n",
"import time\n",
"from mantid.simpleapi import LoadEventAsWorkspace2D, LoadNexus, SaveNexus\n",
"from mantid.simpleapi import LoadNexus, SaveNexus\n",
"from drtsans.mono.biosans import calculate_barscan_calibration, as_intensities, plot_detector\n",
"from drtsans.pixel_calibration import Table\n",
"\n",
Expand Down Expand Up @@ -675,8 +675,7 @@
"outputs": [],
"source": [
"import os\n",
"from mantid.simpleapi import LoadEventNexus\n",
"from drtsans.mono.biosans import load_calibration, plot_detector\n",
"from drtsans.mono.biosans import load_calibration\n",
"\n",
"#\n",
"# \"plot_main_detector\", \"plot_wing_detector\" and \"plot_midrange_detector\" are used to plot both detectors separately\n",
Expand Down Expand Up @@ -791,7 +790,7 @@
"import os\n",
"import time\n",
"from mantid.simpleapi import LoadNexus\n",
"from drtsans.mono.biosans import calculate_apparent_tube_width, plot_detector\n",
"from drtsans.mono.biosans import calculate_apparent_tube_width\n",
"\n",
"#\n",
"# \"plot_main_detector\", \"plot_wing_detector\" and \"plot_midrange_detector\" are used to plot both detectors separately\n",
Expand Down Expand Up @@ -900,7 +899,6 @@
},
"outputs": [],
"source": [
"from drtsans.mono.biosans import calculate_apparent_tube_width\n",
"\n",
"start_time = time.time()\n",
"calibration_main = calculate_apparent_tube_width(\n",
Expand Down Expand Up @@ -996,7 +994,6 @@
"from mantid.api import mtd\n",
"from mantid.simpleapi import CreateWorkspace, LoadNexus\n",
"from drtsans.tubecollection import TubeCollection\n",
"from matplotlib import pyplot as plt\n",
"#\n",
"# \"plot_histograms\" to create fancy plots of the spectram stored in an input workspace\n",
"#\n",
Expand Down
3 changes: 1 addition & 2 deletions notebooks/barscan/biosans_wing_detector_barscan.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"import time\n",
"\n",
"# Mantid imports\n",
"from mantid.simpleapi import LoadEventNexus, LoadNexusProcessed, SaveNexus\n",
"from mantid.simpleapi import LoadNexusProcessed\n",
"# drtsans imports\n",
"from drtsans.pixel_calibration import calculate_barscan_calibration, load_calibration, as_intensities"
]
Expand Down
9 changes: 3 additions & 6 deletions notebooks/biosans/biosans_pixel_calibration_5767.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"import numpy as np\n",
"import os\n",
"import time\n",
"from mantid.simpleapi import LoadEventAsWorkspace2D, LoadNexus, SaveNexus\n",
"from mantid.simpleapi import LoadNexus, SaveNexus\n",
"from drtsans.mono.biosans import calculate_barscan_calibration, as_intensities, plot_detector\n",
"from drtsans.pixel_calibration import Table\n",
"\n",
Expand Down Expand Up @@ -562,8 +562,7 @@
"outputs": [],
"source": [
"import os\n",
"from mantid.simpleapi import LoadEventNexus\n",
"from drtsans.mono.biosans import load_calibration, plot_detector\n",
"from drtsans.mono.biosans import load_calibration\n",
"\n",
"#\n",
"# \"plot_main_detector\" and \"plot_wing_detector\" are used to plot both detectors separately\n",
Expand Down Expand Up @@ -666,7 +665,7 @@
"import os\n",
"import time\n",
"from mantid.simpleapi import LoadNexus\n",
"from drtsans.mono.biosans import calculate_apparent_tube_width, plot_detector\n",
"from drtsans.mono.biosans import calculate_apparent_tube_width\n",
"\n",
"#\n",
"# \"plot_main_detector\" and \"plot_wing_detector\" are used to plot both detectors separately\n",
Expand Down Expand Up @@ -762,7 +761,6 @@
"metadata": {},
"outputs": [],
"source": [
"from drtsans.mono.biosans import calculate_apparent_tube_width\n",
"\n",
"start_time = time.time()\n",
"calibration_main = calculate_apparent_tube_width('flood_workspace', component='detector1',\n",
Expand Down Expand Up @@ -849,7 +847,6 @@
"from mantid.api import mtd\n",
"from mantid.simpleapi import CreateWorkspace, LoadNexus\n",
"from drtsans.tubecollection import TubeCollection\n",
"from matplotlib import pyplot as plt\n",
"#\n",
"# \"plot_histograms\" to create fancy plots of the spectram stored in an input workspace\n",
"#\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,7 @@
"outputs": [],
"source": [
"import os\n",
"from mantid.simpleapi import LoadEventAsWorkspace2D\n",
"from drtsans.mono.biosans import load_calibration, plot_detector\n",
"from drtsans.mono.biosans import load_calibration\n",
"\n",
"#\n",
"# \"plot_main_detector\", \"plot_wing_detector\" and \"plot_midrange_detector\" are used to plot both detectors separately\n",
Expand Down Expand Up @@ -734,7 +733,7 @@
"import os\n",
"import time\n",
"from mantid.simpleapi import LoadNexus\n",
"from drtsans.mono.biosans import calculate_apparent_tube_width, plot_detector\n",
"from drtsans.mono.biosans import calculate_apparent_tube_width\n",
"\n",
"#\n",
"# \"plot_main_detector\", \"plot_wing_detector\" and \"plot_midrange_detector\" are used to plot both detectors separately\n",
Expand Down Expand Up @@ -767,8 +766,7 @@
"outputs": [],
"source": [
"from drtsans.mono.biosans.simulated_intensities import clone_component_intensities, insert_midrange_detector\n",
"from mantid.api import AnalysisDataService\n",
"from mantid.simpleapi import mtd, DeleteWorkspace, DeleteWorkspaces, Integration, LoadEventAsWorkspace2D, SaveNexus\n",
"from mantid.simpleapi import mtd, DeleteWorkspaces, Integration, SaveNexus\n",
"import os\n",
"\n",
"flood_file = '/HFIR/CG3/IPTS-24666/nexus/CG3_5904.nxs.h5'\n",
Expand Down Expand Up @@ -835,7 +833,6 @@
"metadata": {},
"outputs": [],
"source": [
"from drtsans.mono.biosans import calculate_apparent_tube_width\n",
"\n",
"start_time = time.time()\n",
"calibration_main = calculate_apparent_tube_width(\n",
Expand Down Expand Up @@ -929,7 +926,6 @@
"from mantid.api import mtd\n",
"from mantid.simpleapi import CreateWorkspace, LoadNexus\n",
"from drtsans.tubecollection import TubeCollection\n",
"from matplotlib import pyplot as plt\n",
"#\n",
"# \"plot_histograms\" to create fancy plots of the spectram stored in an input workspace\n",
"#\n",
Expand Down
8 changes: 3 additions & 5 deletions notebooks/biosans/biosans_pixel_calibration_838.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"import numpy as np\n",
"import os\n",
"import time\n",
"from mantid.simpleapi import LoadEventAsWorkspace2D, LoadNexus\n",
"from mantid.simpleapi import LoadNexus\n",
"from drtsans.mono.biosans import calculate_barscan_calibration, plot_detector\n",
"\n",
"#\n",
Expand Down Expand Up @@ -204,8 +204,7 @@
"outputs": [],
"source": [
"import os\n",
"from mantid.simpleapi import LoadEventAsWorkspace2D\n",
"from drtsans.mono.biosans import load_calibration, plot_detector\n",
"from drtsans.mono.biosans import load_calibration\n",
"\n",
"#\n",
"# \"plot_main_detector\" and \"plot_wing_detector\" are used to plot both detectors separately\n",
Expand Down Expand Up @@ -346,11 +345,10 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import os\n",
"import time\n",
"from mantid.simpleapi import LoadNexus\n",
"from drtsans.mono.biosans import calculate_apparent_tube_width, plot_detector\n",
"from drtsans.mono.biosans import calculate_apparent_tube_width\n",
"\n",
"#\n",
"# \"plot_main_detector\" and \"plot_wing_detector\" are used to plot both detectors separately\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"import numpy as np\n",
"import os\n",
"import time\n",
"from mantid.simpleapi import LoadEventAsWorkspace2D, LoadNexus,LoadNexusProcessed, Integration, SaveNexus, mtd\n",
"from mantid.simpleapi import LoadNexus,LoadNexusProcessed, Integration, mtd\n",
"from drtsans.mono.biosans import calculate_barscan_calibration, plot_detector\n",
"from drtsans.mono.biosans.simulated_intensities import clone_component_intensities, insert_midrange_detector\n",
"#\n",
Expand Down Expand Up @@ -267,8 +267,7 @@
"outputs": [],
"source": [
"import os\n",
"from mantid.simpleapi import LoadEventNexus\n",
"from drtsans.mono.biosans import load_calibration, plot_detector\n",
"from drtsans.mono.biosans import load_calibration\n",
"\n",
"#\n",
"# \"plot_main_detector\", \"plot_wing_detector\" and \"plot_midrange_detector\" are used to plot both detectors separately\n",
Expand Down Expand Up @@ -421,11 +420,9 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import os\n",
"import time\n",
"from mantid.simpleapi import LoadNexus\n",
"from drtsans.mono.biosans import calculate_apparent_tube_width, plot_detector\n",
"from drtsans.mono.biosans import calculate_apparent_tube_width\n",
"\n",
"#\n",
"# \"plot_main_detector\", \"plot_wing_detector\" and \"plot_midrange_detector\" are used to plot both detectors separately\n",
Expand Down
4 changes: 0 additions & 4 deletions notebooks/gpsans/gpsans_pixel_calibration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@
"# \"plot_workspace\" is a utility function, which we will use a couple of times\n",
"#\n",
"%matplotlib inline\n",
"from drtsans.mono.gpsans import plot_detector\n",
"def plot_workspace(input_workspace, axes_mode='tube-pixel'):\n",
" return plot_detector(input_workspace, backend='mpl',axes_mode=axes_mode, imshow_kwargs={})"
]
Expand Down Expand Up @@ -551,7 +550,6 @@
"\n",
"# \"plot_workspace\" is a utility function, which we will use a couple of times\n",
"%matplotlib inline\n",
"from drtsans.mono.gpsans import plot_detector\n",
"def plot_workspace(input_workspace, axes_mode='tube-pixel'):\n",
" return plot_detector(input_workspace, backend='mpl',axes_mode=axes_mode, imshow_kwargs={})"
]
Expand Down Expand Up @@ -668,7 +666,6 @@
"#\n",
"# \"plot_workspace\" is a utility function, which we will use a couple of times\n",
"#\n",
"from drtsans.mono.gpsans import plot_detector\n",
"def plot_workspace(input_workspace, axes_mode='tube-pixel'):\n",
" return plot_detector(input_workspace, backend='mpl',axes_mode=axes_mode, imshow_kwargs={})"
]
Expand Down Expand Up @@ -908,7 +905,6 @@
"#\n",
"# \"plot_workspace\" is a utility function, which we will use a couple of times\n",
"#\n",
"from drtsans.mono.gpsans import plot_detector\n",
"def plot_workspace(input_workspace, axes_mode='tube-pixel'):\n",
" return plot_detector(input_workspace, backend='mpl',axes_mode=axes_mode, imshow_kwargs={})"
]
Expand Down
3 changes: 0 additions & 3 deletions notebooks/gpsans/gpsans_pixel_calibration_9905.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@
"#\n",
"# \"plot_workspace\" is a utility function, which we will use a couple of times\n",
"#\n",
"from drtsans.mono.gpsans import plot_detector\n",
"def plot_workspace(input_workspace, axes_mode='tube-pixel'):\n",
" return plot_detector(input_workspace, backend='mpl',axes_mode=axes_mode, imshow_kwargs={})"
]
Expand Down Expand Up @@ -686,7 +685,6 @@
"source": [
"import numpy as np\n",
"from drtsans.tubecollection import TubeCollection\n",
"from matplotlib import pyplot as plt\n",
"\n",
"#\n",
"# \"plot_histograms\" to create fancy plots of the spectram stored in an input workspace\n",
Expand Down Expand Up @@ -798,7 +796,6 @@
"#\n",
"# \"plot_workspace\" is a utility function, which we will use a couple of times\n",
"#\n",
"from drtsans.mono.gpsans import plot_detector\n",
"def plot_workspace(input_workspace, axes_mode='tube-pixel'):\n",
" return plot_detector(input_workspace, backend='mpl',axes_mode=axes_mode, imshow_kwargs={})"
]
Expand Down
4 changes: 2 additions & 2 deletions notebooks/gpsans/gpsans_reduction_1config.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"from pprint import pprint as pretty_print\n",
"import time\n",
"from drtsans.mono.gpsans import (load_all_files, reduce_single_configuration, plot_reduction_output,\n",
" reduction_parameters, update_reduction_parameters, validate_reduction_parameters)"
" reduction_parameters, update_reduction_parameters)"
]
},
{
Expand Down Expand Up @@ -194,7 +194,7 @@
"from pprint import pprint as pretty_print\n",
"import time\n",
"from drtsans.mono.gpsans import (load_all_files, reduce_single_configuration, plot_reduction_output,\n",
" reduction_parameters, update_reduction_parameters, validate_reduction_parameters)"
" update_reduction_parameters)"
]
},
{
Expand Down
5 changes: 1 addition & 4 deletions notebooks/tubewidth/gpsans_tubewidth.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
"outputs": [],
"source": [
"# Standard imports\n",
"import os\n",
"import sys\n",
"import time\n",
"\n",
"# Third-party packages\n",
Expand All @@ -26,10 +24,9 @@
"# Mantid imports\n",
"from mantid.simpleapi import LoadEventNexus, Rebin, CreateWorkspace\n",
"from mantid.api import mtd\n",
"from mantid import plots\n",
"\n",
"# drtsans imports\n",
"from drtsans.pixel_calibration import calculate_apparent_tube_width, load_calibration, as_intensities\n",
"from drtsans.pixel_calibration import calculate_apparent_tube_width, load_calibration\n",
"from drtsans.plots import plot_detector\n",
"from drtsans.tubecollection import TubeCollection"
]
Expand Down
1 change: 1 addition & 0 deletions scripts/common_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Common utility functions for all SANS """

import os
import numpy as np
import matplotlib.pyplot as plt
Expand Down
1 change: 1 addition & 0 deletions scripts/examples/plot_wavelength.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Example script to plot the before and after k-correction data for a given slice and frame.
"""

import glob
import os
from pathlib import Path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""

import os
import warnings
from drtsans.mono.gpsans.prepare_sensitivities_correction import SpiceRun
Expand Down
1 change: 1 addition & 0 deletions scripts/prepare_sensitivities_biosans.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Sensitivities preparation script for Bio-SANS (CG3)
"""

from drtsans.mono.biosans.prepare_sensitivities_correction import PrepareSensitivityCorrection

import os
Expand Down
1 change: 1 addition & 0 deletions scripts/prepare_sensitivities_gpsans.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Sensitivities preparation script for GP-SANS (CG2)
"""

from drtsans.prepare_sensivities_correction import PrepareSensitivityCorrection


Expand Down
1 change: 1 addition & 0 deletions scripts/test_help/biosans_synthetic_sensitivity_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
the Midrange Detector. See Fixture ``biosans_synthetic_sensitivity_dataset`` for detailed use
"""

# local imports
from drtsans.load import __monitor_counts
from drtsans.mono.biosans.simulated_intensities import clone_component_intensities, insert_midrange_detector
Expand Down
1 change: 1 addition & 0 deletions src/drtsans/absolute_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Divide <https://docs.mantidproject.org/nightly/algorithms/Divide-v1.html>
Multiply <https://docs.mantidproject.org/nightly/algorithms/Multiply-v1.html>
"""

from mantid.simpleapi import DeleteWorkspace, Divide, Multiply, mtd
from mantid.dataobjects import WorkspaceSingleValue

Expand Down
1 change: 1 addition & 0 deletions src/drtsans/frame_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ class FrameMode(Enum):
r"""
Selects if instrument operating in frame-skipping mode
"""

not_skip = 0
skip = 1
Loading

0 comments on commit e9becb1

Please sign in to comment.