Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.
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
121 changes: 64 additions & 57 deletions Pipfile.lock

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

1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ dev =
pre-commit
pipenv
typed-ast
pep8-naming
mock

[options.packages.find]
Expand Down
3 changes: 1 addition & 2 deletions src/diffcalc_API/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from . import config, errorDefinitions, server
from . import config, server
from ._version_git import __version__

# __all__ defines the public API for the package.
# Each module also defines its own __all__.
__all__ = [
"__version__",
"server",
"errorDefinitions",
"config",
]
9 changes: 4 additions & 5 deletions src/diffcalc_API/config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# this file is for defining constants

savePicklesFolder = "/dls/tmp/ton99817/diffcalc_pickles"
VectorProperties = ["n_hkl", "n_phi", "surf_nhkl", "surf_nphi"]
pickledNames = {"ub", "constraints", "hkl"}
constraintsWithNoValue = {"a_eq_b", "bin_eq_bout", "mu_is_gam", "bisect"}
SAVE_PICKLES_FOLDER = "/dls/tmp/ton99817/diffcalc_pickles"
VECTOR_PROPERTIES = ["n_hkl", "n_phi", "surf_nhkl", "surf_nphi"]
CONSTRAINTS_WITH_NO_VALUE = {"a_eq_b", "bin_eq_bout", "mu_is_gam", "bisect"}

allConstraints = {
ALL_CONSTRAINTS = {
"delta",
"gam" "qaz",
"naz",
Expand Down
22 changes: 0 additions & 22 deletions src/diffcalc_API/errors/Constraints.py

This file was deleted.

69 changes: 0 additions & 69 deletions src/diffcalc_API/errors/UBCalculation.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/diffcalc_API/errors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from diffcalc_API.errors import Constraints, HklCalculation, UBCalculation
from diffcalc_API.errors import constraints, hkl, ub

__all__ = ["HklCalculation", "UBCalculation", "Constraints"]
__all__ = ["hkl", "ub", "constraints"]
26 changes: 26 additions & 0 deletions src/diffcalc_API/errors/constraints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import numpy as np

from diffcalc_API.config import ALL_CONSTRAINTS
from diffcalc_API.errors.definitions import (
ALL_RESPONSES,
DiffcalcAPIException,
ErrorCodes,
)


class Codes(ErrorCodes):
CHECK_CONSTRAINT_EXISTS = 400


responses = {code: ALL_RESPONSES[code] for code in np.unique(Codes().all_codes())}


def check_constraint_exists(constraint: str) -> None:
if constraint not in ALL_CONSTRAINTS:
raise DiffcalcAPIException(
status_code=Codes.CHECK_CONSTRAINT_EXISTS,
detail=(
f"property {constraint} does not exist as a valid constraint."
f" Choose one of {ALL_CONSTRAINTS}"
),
)
Loading