Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# xpdtools [![CI](https://github.com/NSLS2/xpdtools/actions/workflows/ci.yml/badge.svg)](https://github.com/NSLS2/xpdtools/actions/workflows/ci.yml)
# XPD Tools [![CI](https://github.com/NSLS2/xpd-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/NSLS2/xpd-tools/actions/workflows/ci.yml)

Tools for NSLS-II XPD beamline.
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=61", "setuptools_scm[toml]>=7"]
build-backend = "setuptools.build_meta"

[project]
name = "xpdtools"
name = "xpd-tools"
authors = [
{ name = "Brookhaven National Laboratory", email = "jwlodek@bnl.gov" },
]
Expand Down Expand Up @@ -93,10 +93,10 @@ profiles = [
]

[tool.setuptools.package-data]
"xpdtools.panda_configurations" = ["*.yaml"]
"xpd_tools.panda_configurations" = ["*.yaml"]

[tool.setuptools_scm]
write_to = "src/xpdtools/_version.py"
write_to = "src/xpd_tools/_version.py"

[tool.pyright]
typeCheckingMode = "standard"
Expand All @@ -108,7 +108,7 @@ reportMissingImports = false # Ignore missing stubs in imported modules
addopts = """
--tb=native -vv --strict-markers --doctest-modules
--doctest-glob="*.rst" --doctest-glob="*.md"
--ignore=docs/examples --ignore=src/xpdtools/profiles
--ignore=docs/examples --ignore=src/xpd_tools/profiles
"""
# https://iscinumpy.gitlab.io/post/bound-version-constraints/#watch-for-warnings
filterwarnings = [
Expand All @@ -127,7 +127,7 @@ timeout = 60

[tool.coverage.run]
patch = ["subprocess"]
data_file = "/tmp/xpdtools.coverage"
data_file = "/tmp/xpd_tools.coverage"
# branch = true

[tool.coverage.paths]
Expand Down Expand Up @@ -166,7 +166,7 @@ convention = "numpy"
# See https://github.com/DiamondLightSource/python-copier-template/issues/154
# Remove this line to forbid private member access in tests
"tests/**/*" = ["SLF001", "S101", "D"]
"src/xpdtools/profiles/**" = ["F401"]
"src/xpd_tools/profiles/**" = ["F401"]

[tool.ruff.lint.flake8-import-conventions.extend-aliases]
# We often shorten "Annotated" to "A" for brevity
Expand All @@ -177,4 +177,4 @@ convention = "numpy"
extend-ignore-names = ["RE"]

[tool.importlinter]
root_package = "xpdtools"
root_package = "xpd_tools"
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ophyd_async.fastcs.panda import HDFPanda, apply_panda_settings
from ophyd_async.plan_stubs import apply_settings_if_different, retrieve_settings

PANDA_CONFIG_PATH = Path(str(files("xpdtools.panda_configurations")))
PANDA_CONFIG_PATH = Path(str(files("xpd_tools.panda_configurations")))

# Built dynamically from the packaged yaml files, so member names are only known
# at runtime. cast to type[Enum] so the checker treats it as a class (issubclass,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Utility functions for xpdtools detectors."""
"""Utility functions for xpd_tools detectors."""

from collections.abc import Generator
from typing import Any
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/xpdtools/plans.py → src/xpd_tools/plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from ophyd_async.epics.adcore import AreaDetector
from ophyd_async.fastcs.panda import HDFPanda

from xpdtools.detectors.utils import get_detector_acq_times
from xpdtools.flyers import get_zero_encoder_position
from xpd_tools.detectors.utils import get_detector_acq_times
from xpd_tools.flyers import get_zero_encoder_position

from .flyers import (
SingleAxisFlyscanController,
Expand Down
File renamed without changes.
33 changes: 14 additions & 19 deletions src/xpdtools/profiles/xpdd.py → src/xpd_tools/profiles/xpdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
from ophyd_async.plan_stubs import store_settings
from tiled.client import from_uri

from xpdtools.detectors.panda import PandAConfiguration, switch_panda_configuration
from xpdtools.detectors.pilatus4 import Pilatus4Detector
from xpdtools.motors import RotationMotor
from xpdtools.plans import single_axis_flyscan
from xpdtools.utils import ProposalIDPrompt, initialize_run_engine

XPDTOOLS_RUNNING_IN_CI = (
os.environ.get("XPDTOOLS_RUNNING_IN_CI", "false").lower() == "true"
from xpd_tools.detectors.panda import PandAConfiguration, switch_panda_configuration
from xpd_tools.detectors.pilatus4 import Pilatus4Detector
from xpd_tools.motors import RotationMotor
from xpd_tools.plans import single_axis_flyscan
from xpd_tools.utils import ProposalIDPrompt, initialize_run_engine

XPD_TOOLS_RUNNING_IN_CI = (
os.environ.get("XPD_TOOLS_RUNNING_IN_CI", "false").lower() == "true"
)

os.environ["REDIS_HOST"] = "xf28id2-xpdd-redis1.nsls2.bnl.gov"
Expand All @@ -45,22 +45,17 @@
RE.waiting_hook = ProgressBarManager() # type: ignore[assignment]


if not XPDTOOLS_RUNNING_IN_CI:
if not XPD_TOOLS_RUNNING_IN_CI:
tiled_writing_client = from_uri(
"https://tiled.nsls2.bnl.gov",
api_key=os.environ.get("TILED_BLUESKY_WRITING_API_KEY_XPDD", ""),
)["xpdd"]["migration"]
else:
from tiled.server.simple import SimpleTiledServer
from tiled.client import simple

tiled_server = SimpleTiledServer(
directory="/tmp/xpdtools",
readable_storage="/tmp/tiled_server",
api_key="xpdtools",
tiled_reading_client = tiled_writing_client = c = simple(
"/tmp/xpd_tools", api_key="xpd_tools", readable_storage="/tmp/xpd_tools"
)
tiled_writing_client = from_uri(tiled_server.uri)
tiled_reading_client = c = from_uri(tiled_server.uri)


# Setup writing to the database
tw = TiledWriter(tiled_writing_client)
Expand All @@ -74,15 +69,15 @@
if ipython is not None and isinstance(ipython, TerminalInteractiveShell):
ipython.prompts = ProposalIDPrompt(RE, ipython)
ipython.run_line_magic("autoawait", "call_in_bluesky_event_loop")
if not XPDTOOLS_RUNNING_IN_CI:
if not XPD_TOOLS_RUNNING_IN_CI:
tiled_reading_client = c = from_uri("https://tiled.nsls2.bnl.gov")["xpdd"][
"migration"
]


path_provider = NSLS2PathProvider(RE.md, beamline_tla="xpd", beamline_tla_suffix="-new")

with init_devices(mock=XPDTOOLS_RUNNING_IN_CI):
with init_devices(mock=XPD_TOOLS_RUNNING_IN_CI):
panda1 = HDFPanda("XF:28ID2-ES{PANDA:1}:", path_provider)
rot_motor = RotationMotor("XF:28IDD-ES:2{Twister}Mtr")
step_motor = AsyncEpicsMotor("XF:28IDD-ES:2{Twister}Mtr", name="amazon_motor")
Expand Down
4 changes: 2 additions & 2 deletions src/xpdtools/utils.py → src/xpd_tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ def print_version_info():
from ophyd_async import __version__ as ophyd_async_version
from tiled import __version__ as tiled_version

from xpdtools import __version__ as xpdtools_version
from xpd_tools import __version__ as xpd_tools_version

rprint("\n[bold]Version Information[/bold]")
rprint(f" [bold]bluesky[/bold]: [blue]{bluesky_version}[/blue]")
rprint(f" [bold]ophyd_async[/bold]: [blue]{ophyd_async_version}[/blue]")
rprint(f" [bold]tiled[/bold]: [blue]{tiled_version}[/blue]")
rprint(f" [bold]xpdtools[/bold]: [blue]{xpdtools_version}[/blue]\n")
rprint(f" [bold]xpd-tools[/bold]: [blue]{xpd_tools_version}[/blue]\n")


def show_docs(name: str, doc: dict[str, Any]):
Expand Down
2 changes: 1 addition & 1 deletion tests/detectors/test_panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from xpdtools.detectors.panda import (
from xpd_tools.detectors.panda import (
PandAConfiguration,
PandASettingsProvider,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_flyers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from ophyd_async.core import FlyMotorInfo

from xpdtools.flyers import (
from xpd_tools.flyers import (
PandaPcompDirection,
SingleAxisFlyscanInfo,
calculate_move_time_for_flyscan,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_motors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from xpdtools.motors import get_encoder_value_from_pos
from xpd_tools.motors import get_encoder_value_from_pos


@pytest.mark.parametrize(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
from ophyd_async.epics.adcore import ADWriterFactory, NDFileHDF5IO
from ophyd_async.fastcs.panda import DatasetTable, HDFPanda, PandaHdf5DatasetType

from xpdtools.detectors.pilatus4 import Pilatus4Detector
from xpdtools.motors import RotationMotor
from xpdtools.plans import single_axis_flyscan
from xpd_tools.detectors.pilatus4 import Pilatus4Detector
from xpd_tools.motors import RotationMotor
from xpd_tools.plans import single_axis_flyscan

NUM_IMAGES = 11
SCAN_START = 0.0
Expand Down
6 changes: 3 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pygments.token import Token
from pytest_mock import MockerFixture

from xpdtools.utils import ProposalIDPrompt, start_beamtime
from xpd_tools.utils import ProposalIDPrompt, start_beamtime


def test_start_beamtime(
Expand Down Expand Up @@ -37,7 +37,7 @@ def fake_sync_experiment(*args, **kwargs):
return sample_metadata

mocker.patch(
"xpdtools.utils.sync_experiment",
"xpd_tools.utils.sync_experiment",
side_effect=fake_sync_experiment,
)

Expand Down Expand Up @@ -68,7 +68,7 @@ def fake_sync_experiment(*args, **kwargs):
return {}

mocker.patch(
"xpdtools.utils.sync_experiment",
"xpd_tools.utils.sync_experiment",
side_effect=fake_sync_experiment,
)

Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.