DAQ: added ml_bounding_box to loop centering, creates grid scan grid using ml. Fixed bug where filename wouldn't iterate for copied grid scans.

This commit is contained in:
leonarski_f committed 2025-07-04 10:59:42 +02:00
1 parent 804d18db4d
commit 731efccc2b
8 files changed
+124 -18

No files matched your search

+23
View File
@@ -23,6 +23,7 @@ class DAQWorker(QObject):
run_number_incremented = Signal()
raster_scan_completed = Signal(CompletedRasterGrid)
standard_scan_completed = Signal(CompletedRotationScan)
raster_generated_by_ml = Signal(RasterGridRequest)
def __init__(self, base_url: str | None, token: str, parent=None):
super().__init__(parent)
@@ -342,3 +343,25 @@ class DAQWorker(QObject):
@Slot()
def cancel(self):
self.generic_post("scan/cancel")
def handle_ml_box_response(self, reply):
try:
response_data = self.handle_response(reply)
if response_data != "":
parsed_response = RasterGridRequest.model_validate_json(response_data)
self.raster_generated_by_ml.emit(parsed_response)
except Exception as e:
print(e)
self.http_error.emit(str(e))
@Slot()
def ml_bounding_box(self):
if self.__base_url is None:
print(f"POST /alc/ml_bounding_box")
return
request = QNetworkRequest(QUrl(f"{self.__base_url}/alc/ml_bounding_box"))
request.setRawHeader(b"Authorization", f"Bearer {self.__token}".encode("utf-8"))
reply = self.__net_manager.post(request, QByteArray(b""))
reply.finished.connect(lambda: self.handle_ml_box_response(reply))