Skip to content

Commit

Permalink
Run isort
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Dec 6, 2023
1 parent 846e0dd commit b0d714d
Show file tree
Hide file tree
Showing 26 changed files with 71 additions and 141 deletions.
3 changes: 2 additions & 1 deletion src/nexgen/beamlines/ED_singla_nxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from ..nxs_write.NXmxWriter import EDNXmxFileWriter
from ..nxs_write.write_utils import find_number_of_images
from ..tools.ED_tools import extract_from_SINGLA_master, find_beam_centre
from ..utils import coerce_to_path, find_in_dict, get_iso_timestamp, get_nexus_filename
from ..utils import (coerce_to_path, find_in_dict, get_iso_timestamp,

Check warning on line 17 in src/nexgen/beamlines/ED_singla_nxs.py

View workflow job for this annotation

GitHub Actions / lint

isort found an import in the wrong position
get_nexus_filename)

Check warning on line 18 in src/nexgen/beamlines/ED_singla_nxs.py

View workflow job for this annotation

GitHub Actions / lint

isort found an import in the wrong position
from .ED_params import ED_coord_system, EDSingla, EDSource

Check warning on line 19 in src/nexgen/beamlines/ED_singla_nxs.py

View workflow job for this annotation

GitHub Actions / lint

isort found an unexpected missing import

logger = logging.getLogger("nexgen.EDNeXusWriter")
Expand Down
19 changes: 5 additions & 14 deletions src/nexgen/beamlines/I19_2_gda_nxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,16 @@
from numpy.typing import DTypeLike

from .. import log
from ..nxs_utils import (
Attenuator,
Beam,
Detector,
EigerDetector,
Goniometer,
Source,
TristanDetector,
)
from ..nxs_utils import (Attenuator, Beam, Detector, EigerDetector, Goniometer,

Check warning on line 15 in src/nexgen/beamlines/I19_2_gda_nxs.py

View workflow job for this annotation

GitHub Actions / lint

isort found an import in the wrong position
Source, TristanDetector)

Check warning on line 16 in src/nexgen/beamlines/I19_2_gda_nxs.py

View workflow job for this annotation

GitHub Actions / lint

isort found an import in the wrong position
from ..nxs_utils.Detector import DetectorType, UnknownDetectorTypeError

Check warning on line 17 in src/nexgen/beamlines/I19_2_gda_nxs.py

View workflow job for this annotation

GitHub Actions / lint

isort found an unexpected missing import

Check warning on line 17 in src/nexgen/beamlines/I19_2_gda_nxs.py

View workflow job for this annotation

GitHub Actions / lint

isort found an unexpected missing import

Check warning on line 17 in src/nexgen/beamlines/I19_2_gda_nxs.py

View workflow job for this annotation

GitHub Actions / lint

isort found an unexpected missing import

Check warning on line 17 in src/nexgen/beamlines/I19_2_gda_nxs.py

View workflow job for this annotation

GitHub Actions / lint

isort found an unexpected missing import

Check warning on line 17 in src/nexgen/beamlines/I19_2_gda_nxs.py

View workflow job for this annotation

GitHub Actions / lint

isort found an unexpected missing import
from ..nxs_utils.ScanUtils import calculate_scan_points
from ..nxs_write.NXmxWriter import EventNXmxFileWriter, NXmxFileWriter
from ..utils import get_iso_timestamp, get_nexus_filename
from .beamline_utils import BeamlineAxes, collection_summary_log
from .GDAtools.ExtendedRequest import (
ExtendedRequestIO,
read_det_position_from_xml,
read_scan_from_xml,
)
from .GDAtools.ExtendedRequest import (ExtendedRequestIO,
read_det_position_from_xml,
read_scan_from_xml)
from .GDAtools.GDAjson2params import JSONParamsIO

# Define a logger object and a formatter
Expand Down
11 changes: 2 additions & 9 deletions src/nexgen/beamlines/I19_2_nxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@
import numpy as np

from .. import log
from ..nxs_utils import (
Attenuator,
Beam,
Detector,
EigerDetector,
Goniometer,
Source,
TristanDetector,
)
from ..nxs_utils import (Attenuator, Beam, Detector, EigerDetector, Goniometer,
Source, TristanDetector)
from ..nxs_utils.ScanUtils import calculate_scan_points, identify_osc_axis
from ..nxs_write.NXmxWriter import EventNXmxFileWriter, NXmxFileWriter
from ..tools.Metafile import DectrisMetafile
Expand Down
3 changes: 2 additions & 1 deletion src/nexgen/beamlines/SSX_Eiger_nxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import h5py

from .. import log
from ..nxs_utils import Attenuator, Beam, Detector, EigerDetector, Goniometer, Source
from ..nxs_utils import (Attenuator, Beam, Detector, EigerDetector, Goniometer,
Source)
from ..nxs_write.NXmxWriter import NXmxFileWriter
from ..tools.Metafile import DectrisMetafile
from ..tools.MetaReader import define_vds_data_type, update_axes_from_meta
Expand Down
3 changes: 2 additions & 1 deletion src/nexgen/beamlines/SSX_Tristan_nxs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from pathlib import Path

from .. import log
from ..nxs_utils import Attenuator, Beam, Detector, Goniometer, Source, TristanDetector
from ..nxs_utils import (Attenuator, Beam, Detector, Goniometer, Source,
TristanDetector)
from ..nxs_write.NXmxWriter import EventNXmxFileWriter
from ..utils import Point3D, find_in_dict, get_iso_timestamp
from .beamline_utils import collection_summary_log
Expand Down
3 changes: 2 additions & 1 deletion src/nexgen/beamlines/SSX_chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"""
from __future__ import annotations

from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Tuple

from dataclasses import dataclass, field

from ..nxs_utils.ScanUtils import ScanDirection

# I24 chip tools
Expand Down
8 changes: 2 additions & 6 deletions src/nexgen/beamlines/SSX_expt.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@
from ..nxs_utils import Axis, TransformationType
from ..nxs_utils.ScanUtils import calculate_scan_points
from .beamline_utils import PumpProbe
from .SSX_chip import (
Chip,
compute_goniometer,
fullchip_blocks_conversion,
read_chip_map,
)
from .SSX_chip import (Chip, compute_goniometer, fullchip_blocks_conversion,
read_chip_map)

__all__ = ["run_extruder", "run_fixed_target", "run_3D_grid_scan"]

Expand Down
6 changes: 3 additions & 3 deletions src/nexgen/beamlines/beamline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from __future__ import annotations

import logging
from dataclasses import dataclass
from typing import List, Optional, Tuple

from dataclasses import dataclass
from dataclasses_json import DataClassJsonMixin

from nexgen.nxs_utils import Attenuator, Axis, Beam, Detector, Goniometer, Source
from nexgen.nxs_utils import (Attenuator, Axis, Beam, Detector, Goniometer,
Source)
from nexgen.utils import Point3D


Expand Down
2 changes: 1 addition & 1 deletion src/nexgen/command_line/ED_nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

import freephil

from . import config_parser, nexus_parser, version_parser
from .. import log
from ..beamlines.ED_params import ED_coord_system
from ..beamlines.ED_singla_nxs import singla_nexus_writer
from ..nxs_utils import Axis, TransformationType
from . import config_parser, nexus_parser, version_parser

logger = logging.getLogger("nexgen.EDNeXusGeneratorCLI")

Expand Down
2 changes: 1 addition & 1 deletion src/nexgen/command_line/I19_2_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from collections import namedtuple
from datetime import datetime

from .. import log
from . import version_parser
from .. import log

logger = logging.getLogger("nexgen.I19-2_NeXus_cli")

Expand Down
2 changes: 1 addition & 1 deletion src/nexgen/command_line/SSX_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from pathlib import Path
from typing import Tuple

from . import version_parser
from .. import log
from ..beamlines.SSX_chip import CHIP_DICT_DEFAULT
from ..utils import P
from . import version_parser

logger = logging.getLogger("nexgen.SSX_cli")

Expand Down
19 changes: 7 additions & 12 deletions src/nexgen/command_line/cli_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,17 @@
from scanspec.core import Path as ScanPath
from scanspec.specs import Line

from ..nxs_write.NXclassWriters import (
write_NXdata,
write_NXdatetime,
write_NXdetector,
write_NXdetector_module,
write_NXentry,
write_NXinstrument,
write_NXnote,
write_NXsample,
write_NXsource,
)
from ..nxs_write.NXclassWriters import (write_NXdata, write_NXdatetime,
write_NXdetector,
write_NXdetector_module, write_NXentry,
write_NXinstrument, write_NXnote,
write_NXsample, write_NXsource)
from ..nxs_write.write_utils import find_number_of_images
from ..tools.DataWriter import generate_event_files, generate_image_files
from ..tools.MetaReader import overwrite_beam, overwrite_detector
from ..tools.VDS_tools import image_vds_writer, vds_file_writer
from ..utils import coord2mcstas, get_filename_template, imgcif2mcstas, units_of_time
from ..utils import (coord2mcstas, get_filename_template, imgcif2mcstas,
units_of_time)


def split_arrays(axes_names: List, array: List) -> Dict[str, Tuple]:
Expand Down
3 changes: 2 additions & 1 deletion src/nexgen/command_line/copy_nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

import freephil

from . import (config_parser, full_copy_parser, tristan_copy_parser,
version_parser)
from .. import log
from ..nxs_copy import CopyNexus, CopyTristanNexus
from . import config_parser, full_copy_parser, tristan_copy_parser, version_parser

# Define a logger object and a formatter
logger = logging.getLogger("nexgen.CopyNeXus")
Expand Down
25 changes: 8 additions & 17 deletions src/nexgen/command_line/nexus_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,18 @@
import h5py
import numpy as np

from . import (add_tristan_spec, config_parser, demo_parser,
detectormode_parser, nexus_parser, phil2dict, version_parser)
from .. import log
from ..nxs_write.NXclassWriters import write_NXdatetime, write_NXentry, write_NXnote
from ..nxs_write.NXclassWriters import (write_NXdatetime, write_NXentry,
write_NXnote)
from ..tools.DataWriter import generate_event_files, generate_image_files
from ..tools.MetaReader import overwrite_beam, overwrite_detector
from ..tools.VDS_tools import image_vds_writer, vds_file_writer
from ..utils import (
get_filename_template,
get_iso_timestamp,
get_nexus_filename,
units_of_time,
)
from . import (
add_tristan_spec,
config_parser,
demo_parser,
detectormode_parser,
nexus_parser,
phil2dict,
version_parser,
)
from .cli_utils import ScanReader, call_writers # write_nexus_demo, write_nexus
from ..utils import (get_filename_template, get_iso_timestamp,
get_nexus_filename, units_of_time)
from .cli_utils import (ScanReader, # write_nexus_demo, write_nexus
call_writers)

# Define a logger object
logger = logging.getLogger("nexgen.NeXusGenerator")
Expand Down
2 changes: 1 addition & 1 deletion src/nexgen/command_line/phil_files_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import freephil

from .. import log, templates
from . import config_parser, nexus_parser, version_parser
from .. import log, templates

try:
from importlib.resources import files
Expand Down
10 changes: 3 additions & 7 deletions src/nexgen/nxs_copy/CopyTristanNexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@

from ..nxs_write.NXclassWriters import write_NXnote
from ..nxs_write.write_utils import create_attributes
from .copy_utils import (
check_and_fix_det_axis,
compute_ssx_axes,
convert_scan_axis,
get_nexus_tree,
identify_tristan_scan_axis,
)
from .copy_utils import (check_and_fix_det_axis, compute_ssx_axes,
convert_scan_axis, get_nexus_tree,
identify_tristan_scan_axis)

tristan_logger = logging.getLogger("nexgen.CopyTristanNeXus")

Expand Down
3 changes: 2 additions & 1 deletion src/nexgen/nxs_utils/Axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"""
from __future__ import annotations

from dataclasses import dataclass
from enum import Enum
from typing import Tuple

from dataclasses import dataclass

from ..utils import Point3D


Expand Down
2 changes: 1 addition & 1 deletion src/nexgen/nxs_utils/Detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"""
from __future__ import annotations

from dataclasses import dataclass, field
from typing import Dict, List, Literal, Tuple, Union

from dataclasses import dataclass, field
from dataclasses_json import DataClassJsonMixin

from ..utils import Point3D
Expand Down
9 changes: 2 additions & 7 deletions src/nexgen/nxs_utils/Goniometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@
from numpy.typing import ArrayLike

from .Axes import Axis
from .ScanUtils import (
GridScanOptions,
ScanDirection,
calculate_scan_points,
identify_grid_scan_axes,
identify_osc_axis,
)
from .ScanUtils import (GridScanOptions, ScanDirection, calculate_scan_points,
identify_grid_scan_axes, identify_osc_axis)


class Goniometer:
Expand Down
1 change: 0 additions & 1 deletion src/nexgen/nxs_utils/Sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import annotations

from dataclasses import dataclass

from dataclasses_json import DataClassJsonMixin


Expand Down
2 changes: 1 addition & 1 deletion src/nexgen/nxs_utils/Source.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from __future__ import annotations

from collections import namedtuple
from dataclasses import dataclass

from dataclasses import dataclass
from dataclasses_json import DataClassJsonMixin

# Describe facility
Expand Down
20 changes: 5 additions & 15 deletions src/nexgen/nxs_write/NXclassWriters.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,19 @@
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple, get_args

import h5py # isort: skip
import numpy as np
from numpy.typing import ArrayLike

from ..nxs_utils import Axis
from ..utils import (
MAX_SUFFIX_DIGITS,
get_iso_timestamp,
units_of_length,
units_of_time,
ureg,
)
from .write_utils import (
TSdset,
calculate_origin,
create_attributes,
set_dependency,
write_compressed_copy,
)
from ..utils import (MAX_SUFFIX_DIGITS, get_iso_timestamp, units_of_length,
units_of_time, ureg)
from .write_utils import (TSdset, calculate_origin, create_attributes,
set_dependency, write_compressed_copy)

# from hdf5plugin import Bitshuffle # noqa: F401


import h5py # isort: skip


NXclass_logger = logging.getLogger("nexgen.NXclass_writers")

Check failure on line 26 in src/nexgen/nxs_write/NXclassWriters.py

View workflow job for this annotation

GitHub Actions / lint

too many blank lines (4)
Expand Down
33 changes: 9 additions & 24 deletions src/nexgen/nxs_write/NXmxWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,15 @@
from ..nxs_utils.Detector import Detector
from ..nxs_utils.Goniometer import Goniometer
from ..nxs_utils.Source import Attenuator, Beam, Source
from ..tools.VDS_tools import (
clean_unused_links,
image_vds_writer,
jungfrau_vds_writer,
vds_file_writer,
)
from ..utils import (
MAX_FRAMES_PER_DATASET,
MAX_SUFFIX_DIGITS,
coord2mcstas,
get_filename_template,
)
from .NXclassWriters import (
write_NXcoordinate_system_set,
write_NXdata,
write_NXdatetime,
write_NXdetector,
write_NXdetector_module,
write_NXentry,
write_NXinstrument,
write_NXnote,
write_NXsample,
write_NXsource,
)
from ..tools.VDS_tools import (clean_unused_links, image_vds_writer,
jungfrau_vds_writer, vds_file_writer)
from ..utils import (MAX_FRAMES_PER_DATASET, MAX_SUFFIX_DIGITS, coord2mcstas,
get_filename_template)
from .NXclassWriters import (write_NXcoordinate_system_set, write_NXdata,
write_NXdatetime, write_NXdetector,
write_NXdetector_module, write_NXentry,
write_NXinstrument, write_NXnote, write_NXsample,
write_NXsource)
from .write_utils import TSdset, calculate_estimated_end_time

# Logger
Expand Down
Loading

0 comments on commit b0d714d

Please sign in to comment.