diff --git a/gui/src/aaregui/main.py b/gui/src/aaregui/main.py
index a8ef6e9e..b54fbef1 100644
--- a/gui/src/aaregui/main.py
+++ b/gui/src/aaregui/main.py
@@ -55,7 +55,7 @@ if __name__ == "__main__":
parser.process(app)
base_url = parser.value(urlOption)
- if base_url == "":
+ if base_url == "" or base_url.lower() == "none":
base_url = None
zmq_addr = parser.value(cameraZeroMQ)
diff --git a/gui/src/aaregui/scan_logic/raster_grid_manager.py b/gui/src/aaregui/scan_logic/raster_grid_manager.py
index 70b67ddf..7efec9ff 100644
--- a/gui/src/aaregui/scan_logic/raster_grid_manager.py
+++ b/gui/src/aaregui/scan_logic/raster_grid_manager.py
@@ -194,24 +194,23 @@ class RasterGridManager(QObject):
if 0 <= cell_x < n_x and 0 <= cell_y < n_y:
cell = cell_y * n_x + cell_x
txt = ""
+ if cell < len(grid.result.images) and grid.result.images[cell].efficiency == 1.0:
+ txt += f"Image {grid.result.images[cell].number}
"
- if cell < len(grid.image_number):
- txt += f"Image {grid.image_number[cell]}
"
+ if grid.result.images[cell].bkg is not None and grid.result.images[cell].bkg >= 0:
+ txt += f"Background estimate {grid.result.images[cell].bkg:.2f}
"
- if cell < len(grid.bkg_estimate):
- txt += f"Background estimate {grid.bkg_estimate[cell]:.2f}
"
+ if grid.result.images[cell].spots is not None and grid.result.images[cell].spots >= 0:
+ txt += f"Spot count {grid.result.images[cell].spots}
"
- if cell < len(grid.spot_count):
- txt += f"Spot count {grid.spot_count[cell]}
"
+ if grid.result.images[cell].index is not None and grid.result.images[cell].index > 0:
+ txt += "Indexed
"
- if cell < len(grid.indexed) and grid.indexed[cell] > 0:
- txt += "Indexed
"
+ if grid.result.images[cell].b is not None and grid.result.images[cell].b >= 0:
+ txt += f"B-factor {grid.result.images[cell].b:.2f}
"
- if cell < len(grid.b_factor) and grid.b_factor[cell] >= 0:
- txt += f"B-factor {grid.b_factor[cell]:.2f}
"
-
- if cell < len(grid.mosaicity) and grid.mosaicity[cell] >= 0:
- txt += f"Mosaicity {grid.mosaicity[cell]:.2f}"
+ if grid.result.images[cell].mos is not None and grid.result.images[cell].mos >= 0:
+ txt += f"Mosaicity {grid.result.images[cell].mos:.2f}"
return txt
return ""
@@ -243,17 +242,19 @@ class RasterGridManager(QObject):
self._draw_grid(painter, self.__active_grid)
for i in self.__completed_grids:
v = None
+
+
match self.__metric:
case RasterGridMetric.BKG:
- v = i.bkg_estimate
+ v = [obj.bkg for obj in i.result.images]
case RasterGridMetric.SPOTS:
- v = i.spot_count
+ v = [obj.spots for obj in i.result.images]
case RasterGridMetric.INDEXING:
- v = i.indexed
+ v = [obj.index for obj in i.result.images]
case RasterGridMetric.MOS:
- v = i.mosaicity
+ v = [obj.mos for obj in i.result.images]
case RasterGridMetric.BFACTOR:
- v = i.b_factor
+ v = [obj.b for obj in i.result.images]
self._draw_grid(painter, i.request, v, alpha)
def _draw_grid(self, painter: QPainter, grid: RasterGridRequest, values: List[float] | List[int] | None = None,
diff --git a/gui/src/aaregui/threads/daq_worker.py b/gui/src/aaregui/threads/daq_worker.py
index e28631ff..831c7060 100644
--- a/gui/src/aaregui/threads/daq_worker.py
+++ b/gui/src/aaregui/threads/daq_worker.py
@@ -3,13 +3,13 @@ import random
from PySide6.QtCore import Signal, QUrl, Slot, QTimer, QObject, QByteArray
from PySide6.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
+from jfjoch_client import ScanResult, ScanResultImagesInner
+from aaredaqlib.coordinate import SmargonCoordinate, Coordinate
from aaredaqlib.models import DAQStatusModel, SampleShortInfoList, SampleShortInfo, SampleCameraSettings, \
AutofocusSettings
-from aaredaqlib.coordinate import SmargonCoordinate, Coordinate
from aaredaqlib.raster_grid import RasterGridRequest, CompletedRasterGrid
from aaredaqlib.rotation_scan import RotationScanRequest
-import numpy as np
SPREADHSEET_FREQUENCY = 25 # Every 5 seconds
@@ -208,14 +208,20 @@ class DAQWorker(QObject):
image_number = r.get_image_number()
new_copy = copy.deepcopy(r)
- reply = CompletedRasterGrid(request=new_copy,
- image_number= [i for i in range(image_number)],
- bkg_estimate=[random.gauss(3.0, 0.1) for _ in range(image_number)],
- spot_count=[random.randint(0, 250) for _ in range(image_number)],
- indexed=[random.randint(0, 1) for _ in range(image_number)],
- mosaicity=[random.uniform(0, 0.1) for _ in range(image_number)],
- b_factor=[random.uniform(15.0, 80.0) for _ in range(image_number)])
+ images = []
+ for i in range(image_number):
+ images.append(ScanResultImagesInner(
+ number=i,
+ efficiency=1.0,
+ bkg = random.gauss(3.0, 0.1),
+ spots= random.randint(0, 250),
+ index= random.randint(0, 1),
+ mos = random.uniform(0, 0.1),
+ b= random.uniform(15.0, 80.0)
+ ))
+ reply = CompletedRasterGrid(request = new_copy,
+ result = ScanResult(file_prefix=r.file_prefix, images=images))
self.raster_scan_completed.emit(reply)
return
diff --git a/test.ipynb b/test.ipynb
new file mode 100644
index 00000000..5e2093c0
--- /dev/null
+++ b/test.ipynb
@@ -0,0 +1,145 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "id": "initial_id",
+ "metadata": {
+ "collapsed": true,
+ "ExecuteTime": {
+ "end_time": "2025-05-19T14:02:45.131974Z",
+ "start_time": "2025-05-19T14:02:44.020840Z"
+ }
+ },
+ "source": [
+ "from aaredaq.devices import BeamlineDevices\n",
+ "from aaredaq.beamline import MXBeamline"
+ ],
+ "outputs": [],
+ "execution_count": 1
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-05-19T14:02:47.337605Z",
+ "start_time": "2025-05-19T14:02:45.686407Z"
+ }
+ },
+ "cell_type": "code",
+ "source": "d = BeamlineDevices(MXBeamline.X06DA)",
+ "id": "4deb7964c8ca4964",
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Connecting TELL p-shell service at http://x06da-tell.psi.ch:22222 ..."
+ ]
+ }
+ ],
+ "execution_count": 2
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-05-19T13:44:40.713609Z",
+ "start_time": "2025-05-19T13:44:40.710429Z"
+ }
+ },
+ "cell_type": "code",
+ "source": "d.shutter",
+ "id": "8a2651e47eea2441",
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "False"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "execution_count": 5
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-05-19T13:44:49.376359Z",
+ "start_time": "2025-05-19T13:44:49.374050Z"
+ }
+ },
+ "cell_type": "code",
+ "source": "d.shutter = False",
+ "id": "f83e9d8a7ef278e8",
+ "outputs": [],
+ "execution_count": 7
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-05-19T13:46:27.545922Z",
+ "start_time": "2025-05-19T13:46:27.543624Z"
+ }
+ },
+ "cell_type": "code",
+ "source": "import cv2",
+ "id": "9020825c2384f66f",
+ "outputs": [],
+ "execution_count": 8
+ },
+ {
+ "metadata": {
+ "ExecuteTime": {
+ "end_time": "2025-05-19T14:02:48.515467Z",
+ "start_time": "2025-05-19T14:02:48.510654Z"
+ }
+ },
+ "cell_type": "code",
+ "source": "d.energy_kev",
+ "id": "54332669c0b21992",
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "13.002"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "execution_count": 3
+ },
+ {
+ "metadata": {},
+ "cell_type": "code",
+ "outputs": [],
+ "execution_count": null,
+ "source": "",
+ "id": "b53d61700246a8f0"
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.6"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}