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: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pdfstream/_version.py export-subst
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,7 @@ local
rever/
/docs/examples/outputs/
.vscode/settings.json

# pixi environments
.pixi
*.egg-info
2 changes: 1 addition & 1 deletion pdfstream/analyzers/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from configparser import ConfigParser

from bluesky.callbacks.core import CallbackBase
from databroker.core import BlueskyRun
from databroker.client import BlueskyRun


class AnalyzerConfig(ConfigParser):
Expand Down
2 changes: 1 addition & 1 deletion pdfstream/analyzers/xpd_analyzer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import typing as tp

from databroker import catalog
from databroker.core import BlueskyRun
from databroker.client import BlueskyRun

from pdfstream.analyzers.base import AnalyzerConfig, Analyzer
from pdfstream.servers.xpd_server import XPDRouter, XPDConfig
Expand Down
8 changes: 4 additions & 4 deletions pdfstream/callbacks/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ def process(
"chi_2theta": np.array([0.]),
"chi_Q": np.array([0.]),
"chi_I": np.array([0.]),
"chi_max": np.float(0.),
"chi_argmax": np.float(0.),
"chi_max": np.float64(0.),
"chi_argmax": np.float64(0.),
"iq_Q": np.array([0.]),
"iq_I": np.array([0.]),
"sq_Q": np.array([0.]),
Expand All @@ -347,8 +347,8 @@ def process(
"fq_F": np.array([0.]),
"gr_r": np.array([0.]),
"gr_G": np.array([0.]),
"gr_max": np.float(0.),
"gr_argmax": np.float(0.)
"gr_max": np.float64(0.),
"gr_argmax": np.float64(0.)
}
# dark subtraction
if dk_img is not None:
Expand Down
7 changes: 4 additions & 3 deletions pdfstream/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import fabio
import numpy as np
import pyFAI
from pyFAI.integrator.azimuthal import AzimuthalIntegrator
import yaml
from numpy import ndarray
from tifffile import TiffWriter
Expand All @@ -14,15 +15,15 @@
from pdfstream.vend.loaddata import load_data


def load_ai_from_poni_file(poni_file: str) -> pyFAI.AzimuthalIntegrator:
def load_ai_from_poni_file(poni_file: str) -> AzimuthalIntegrator:
"""Initiate the AzimuthalIntegrator using poni file."""
ai = pyFAI.load(poni_file)
return ai


def load_ai_from_calib_result(calib_result: dict) -> pyFAI.AzimuthalIntegrator:
def load_ai_from_calib_result(calib_result: dict) -> AzimuthalIntegrator:
"""Initiate the AzimuthalIntegrator using calibration information."""
ai = pyFAI.azimuthalIntegrator.AzimuthalIntegrator()
ai = AzimuthalIntegrator()
# different from poni file, set_config only accepts dictionary of lowercase keys
_calib_result = _lower_key(calib_result)
# the pyFAI only accept strings so the None should be parsed to a string
Expand Down
4 changes: 2 additions & 2 deletions pdfstream/servers/xpd_server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""The analysis server. Process raw image to PDF."""
import typing as tp

import databroker.core
import databroker.mongo_normalized
from bluesky.callbacks.zmq import Publisher
from databroker.v1 import Broker
from event_model import RunRouter
Expand Down Expand Up @@ -99,7 +99,7 @@ def __init__(self, config: XPDConfig):
factory = XPDFactory(config)
super(XPDRouter, self).__init__(
[factory],
handler_registry=databroker.core.discover_handlers()
handler_registry=databroker.mongo_normalized.discover_handlers()
)


Expand Down
4 changes: 1 addition & 3 deletions pdfstream/vend/qt_kicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ def install_qt_kicker(loop=None, update_rate=0.03):
return
if not any(p in sys.modules for p in ['PyQt4', 'pyside', 'PyQt5']):
return
import matplotlib.backends.backend_qt5
from matplotlib.backends.backend_qt5 import _create_qApp
from matplotlib._pylab_helpers import Gcf

_create_qApp()
qApp = matplotlib.backends.backend_qt5.qApp
qApp = _create_qApp()

try:
_draw_all = Gcf.draw_all # mpl version >= 1.5
Expand Down
8,037 changes: 8,037 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[workspace]
authors = ["Thomas A Caswell <tcaswell@bnl.gov>"]
channels = ["conda-forge"]
name = "PDFstream"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
python = "==3.10"
bluesky-base = ">=1.14.1,<2"
fire = ">=0.7.0,<0.8"
pyfai = ">=2025.3.0,<2026"
tiled = ">=0.1.0b28,<0.2"
databroker = ">=2.0.0b62,<3"
suitcase-csv = ">=0.3.0,<0.4"
suitcase-json-metadata = ">=0.2.1,<0.3"
scikit-beam = ">=0.0.26,<0.0.27"
suitcase-tiff = ">=0.4.0,<0.5"
xpdview = ">=0.5.0,<0.6"
"diffpy.pdfgui" = ">=3.0.5,<4"
xray-vision = ">=0.1.1,<0.2"

[pypi-dependencies]
pdfstream = { path = ".", editable = true }

[tasks.server]
args = ["ini"]
cmd = "run_server {{ ini }}"