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
1 change: 1 addition & 0 deletions Framework/PythonInterface/mantid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# ruff: noqa: F403 # Allow wild imports
"""
Mantid
======
Expand Down
1 change: 1 addition & 0 deletions Framework/PythonInterface/mantid/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# ruff: noqa: F403 # Allow wild imports
"""
api
===
Expand Down
1 change: 1 addition & 0 deletions Framework/PythonInterface/mantid/geometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# ruff: noqa: F403 # Allow wild imports
"""
mantid.geometry
===============
Expand Down
1 change: 1 addition & 0 deletions Framework/PythonInterface/mantid/kernel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# ruff: noqa: F403 # Allow wild imports
"""
kernel
=============
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# ruff: noqa: F403 # Allow wild imports
from .dataclasses import *
1 change: 1 addition & 0 deletions Framework/PythonInterface/mantid/simpleapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# ruff: noqa: F403 # Allow wild imports
"""
This module defines a function-style API for running Mantid
algorithms. Each algorithm within Mantid is mapped to a Python
Expand Down
1 change: 1 addition & 0 deletions Framework/PythonInterface/mantid/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# ruff: noqa: F403 # Allow wild imports
from ._utils import *
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import numpy as np
import scipy as sc

from mantid.simpleapi import *
from mantid.kernel import *
from mantid.api import *
from mantid.api import mtd, AlgorithmFactory, PythonAlgorithm, WorkspaceProperty
from mantid.kernel import Direction, FloatMandatoryValidator
from mantid.simpleapi import CreateWorkspace


class NMoldyn4Interpolation(PythonAlgorithm):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init
from mantid.kernel import *
from mantid.api import MatrixWorkspaceProperty, DataProcessorAlgorithm, AlgorithmFactory
from mantid.simpleapi import *
from mantid.api import mtd, MatrixWorkspaceProperty, DataProcessorAlgorithm, AlgorithmFactory
from mantid.kernel import Direction
from mantid.simpleapi import CloneWorkspace, DeleteWorkspace, ExtractSpectra, Scale

import numpy as np

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init

from mantid.api import PythonAlgorithm, AlgorithmFactory, ITableWorkspaceProperty
from mantid.kernel import Direction
from mantid.simpleapi import *
from mantid import mtd

# Create an empty table workspace to be populated by a python script.
from mantid.api import mtd, AnalysisDataService, PythonAlgorithm, AlgorithmFactory, ITableWorkspaceProperty
from mantid.kernel import logger, Direction
from mantid.simpleapi import (
CombinePeaksWorkspaces,
FilterPeaks,
FindUBUsingIndexedPeaks,
GroupWorkspaces,
IndexPeaks,
OptimizeCrystalPlacement,
StatisticsOfTableWorkspace,
RenameWorkspace,
)


class OptimizeCrystalPlacementByRun(PythonAlgorithm):
Expand Down
18 changes: 13 additions & 5 deletions Framework/PythonInterface/plugins/algorithms/PDToGUDRUN.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init
from mantid.simpleapi import *
from mantid.api import *
from mantid.kernel import Direction, FloatArrayProperty, StringListValidator
import mantid
from mantid.api import mtd, AlgorithmFactory, DataProcessorAlgorithm, FileAction, FileProperty, PropertyMode, MatrixWorkspaceProperty
from mantid.kernel import ConfigService, Direction, FloatArrayProperty, StringListValidator
from mantid.simpleapi import (
AlignAndFocusPowder,
LoadDetectorsGroupingFile,
LoadEventAndCompress,
NormaliseByCurrent,
PDDetermineCharacterizations,
PDLoadCharacterizations,
SaveNexusPD,
SetUncertainties,
)

COMPRESS_TOL_TOF = 0.01
EVENT_WORKSPACE_ID = "EventWorkspace"
Expand Down Expand Up @@ -161,7 +169,7 @@ def PyExec(self):
groupingFile = self.getProperty("GroupingFile").value
if len(groupingFile) > 0:
instrumentName = wksp.getInstrument().getName()
instrumentName = mantid.ConfigService.getInstrument(instrumentName).shortName()
instrumentName = ConfigService.getInstrument(instrumentName).shortName()
LoadDetectorsGroupingFile(InputFile=groupingFile, OutputWorkspace=instrumentName + "_group")

wksp = AlignAndFocusPowder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init
from mantid.kernel import *
from mantid.api import *
import mantid.simpleapi
from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, MatrixWorkspaceProperty
from mantid.kernel import Direction
from mantid.simpleapi import LoadAscii
import math


Expand Down Expand Up @@ -39,7 +39,7 @@ def PyExec(self):

wkspace_name = self.getPropertyValue("OutputWorkspace")
# Load the file
ascii_wkspace = mantid.simpleapi.LoadAscii(Filename=filename, OutputWorkspace=wkspace_name, Separator="Space", Unit=x_unit)
ascii_wkspace = LoadAscii(Filename=filename, OutputWorkspace=wkspace_name, Separator="Space", Unit=x_unit)
if thickness is None:
coeffs = ascii_wkspace
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,38 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name,too-few-public-methods,unused-import
from mantid.kernel import *
from mantid.simpleapi import *
from mantid.api import *
from mantid.geometry import *
from mantid.api import AlgorithmFactory, FileAction, FileProperty, PythonAlgorithm, WorkspaceProperty
from mantid.geometry import SpaceGroupFactory
from mantid.kernel import logger, Direction
from mantid.simpleapi import GroupWorkspaces, PoldiCreatePeaksFromCell

import os

PYPARSING_AVAILABLE = True
try:
from pyparsing import (
alphas,
alphanums,
delimitedList,
lineEnd,
nums,
restOfLine,
stringEnd,
CaselessLiteral,
Combine,
Each,
Group,
Literal,
OneOrMore,
Optional,
ParseException,
Suppress,
White,
Word,
)
except ImportError:
PYPARSING_AVAILABLE = False


class PoldiCompound(object):
"""Small helper class to handle the results from PoldiCrystalFileParser."""
Expand Down Expand Up @@ -224,11 +249,9 @@ def _createPeaksFromCell(self, compound, dMin, dMax):
return compound.getName()


try:
from pyparsing import *

if PYPARSING_AVAILABLE:
AlgorithmFactory.subscribe(PoldiCreatePeaksFromFile)
except ImportError:
else:
logger.debug(
"Failed to subscribe algorithm PoldiCreatePeaksFromFile; Python package pyparsing"
"may be missing (https://pypi.python.org/pypi/pyparsing)"
Expand Down
16 changes: 13 additions & 3 deletions Framework/PythonInterface/plugins/algorithms/PoldiLoadRuns.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name,bare-except
from mantid.kernel import *
from mantid.simpleapi import *
from mantid.api import *
from mantid.api import AnalysisDataService, AlgorithmFactory, PythonAlgorithm, WorkspaceGroup, WorkspaceProperty
from mantid.kernel import CompositeValidator, Direction, IntBoundedValidator, IntMandatoryValidator
from mantid.simpleapi import (
DeleteWorkspace,
GroupWorkspaces,
Integration,
MaskDetectors,
MedianDetectorTest,
PoldiMerge,
PoldiTruncateData,
LoadInstrument,
LoadSINQ,
)

from datetime import date

Expand Down
6 changes: 3 additions & 3 deletions Framework/PythonInterface/plugins/algorithms/PoldiMerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name
from mantid.kernel import StringArrayProperty, Direction
from mantid.simpleapi import *
from mantid.api import *
from mantid.api import AlgorithmFactory, AnalysisDataService, MatrixWorkspace, PythonAlgorithm, WorkspaceGroup, WorkspaceProperty
from mantid.kernel import Direction, StringArrayProperty
from mantid.simpleapi import MergeRuns

import numpy as np

Expand Down
4 changes: 2 additions & 2 deletions Framework/PythonInterface/plugins/algorithms/RebinRagged.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name
from mantid.api import *
from mantid.api import mtd, AlgorithmFactory, PythonAlgorithm, MatrixWorkspace, MatrixWorkspaceProperty
from mantid.kernel import Direction, FloatArrayProperty, Property
from mantid.simpleapi import ConjoinWorkspaces, Rebin, DeleteWorkspace, ExtractSpectra
from mantid.kernel import *
import numpy as np


Expand Down
Loading
Loading