-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reconstruction data prep utility to facilitate beamline data pipeline integration
- Loading branch information
1 parent
c43c5a9
commit a06d067
Showing
35 changed files
with
734 additions
and
468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
from abc import ABC, abstractmethod | ||
from collections.abc import Mapping | ||
from pathlib import Path | ||
from typing import Any | ||
|
||
from ptychodus.api.geometry import ImageExtent | ||
from ptychodus.api.patterns import CropCenter | ||
from ptychodus.api.settings import PathPrefixChange | ||
|
||
|
||
class WorkflowProductAPI(ABC): | ||
|
||
@abstractmethod | ||
def openScan(self, filePath: Path, *, fileType: str | None = None) -> None: | ||
pass | ||
|
||
@abstractmethod | ||
def buildScan(self, builderName: str, builderParameters: Mapping[str, Any] = {}) -> None: | ||
pass | ||
|
||
@abstractmethod | ||
def openProbe(self, filePath: Path, *, fileType: str | None = None) -> None: | ||
pass | ||
|
||
@abstractmethod | ||
def buildProbe(self, builderName: str, builderParameters: Mapping[str, Any] = {}) -> None: | ||
pass | ||
|
||
@abstractmethod | ||
def openObject(self, filePath: Path, *, fileType: str | None = None) -> None: | ||
pass | ||
|
||
@abstractmethod | ||
def buildObject(self, builderName: str, builderParameters: Mapping[str, Any] = {}) -> None: | ||
pass | ||
|
||
@abstractmethod | ||
def reconstruct(self) -> None: | ||
pass | ||
|
||
@abstractmethod | ||
def saveProduct(self, filePath: Path, *, fileType: str | None = None) -> None: | ||
pass | ||
|
||
|
||
class WorkflowAPI(ABC): | ||
|
||
@abstractmethod | ||
def openPatterns( | ||
self, | ||
filePath: Path, | ||
*, | ||
fileType: str | None = None, | ||
cropCenter: CropCenter | None = None, | ||
cropExtent: ImageExtent | None = None, | ||
) -> None: | ||
'''opens diffraction patterns from file''' | ||
pass | ||
|
||
@abstractmethod | ||
def importProcessedPatterns(self, filePath: Path) -> None: | ||
'''import processed patterns''' | ||
pass | ||
|
||
@abstractmethod | ||
def exportProcessedPatterns(self, filePath: Path) -> None: | ||
'''export processed patterns''' | ||
pass | ||
|
||
@abstractmethod | ||
def openProduct(self, filePath: Path, *, fileType: str | None = None) -> WorkflowProductAPI: | ||
'''opens product from file''' | ||
pass | ||
|
||
@abstractmethod | ||
def createProduct( | ||
self, | ||
name: str, | ||
*, | ||
comments: str = '', | ||
detectorDistanceInMeters: float | None = None, | ||
probeEnergyInElectronVolts: float | None = None, | ||
probePhotonsPerSecond: float | None = None, | ||
exposureTimeInSeconds: float | None = None, | ||
) -> WorkflowProductAPI: | ||
'''creates a new product''' | ||
pass | ||
|
||
@abstractmethod | ||
def saveSettings(self, | ||
filePath: Path, | ||
changePathPrefix: PathPrefixChange | None = None) -> None: | ||
pass | ||
|
||
|
||
class FileBasedWorkflow(ABC): | ||
|
||
@abstractmethod | ||
def getFilePattern(self) -> str: | ||
'''UNIX-style filename pattern. For rules see fnmatch from Python standard library.''' | ||
pass | ||
|
||
@abstractmethod | ||
def execute(self, api: WorkflowAPI, filePath: Path) -> None: | ||
'''uses workflow API to execute the workflow''' | ||
pass |
Oops, something went wrong.