-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removed unused imports. * Skipped the run_browser tests since they produce seg faults. * Black and isort.
- Loading branch information
1 parent
83a1858
commit febd4f0
Showing
11 changed files
with
160 additions
and
127 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
import gc | ||
import asyncio | ||
import os | ||
import subprocess | ||
from pathlib import Path | ||
from unittest import mock | ||
|
||
import psutil | ||
from qasync import QEventLoop, DefaultQEventLoopPolicy | ||
import numpy as np | ||
import pandas as pd | ||
|
||
# from pydm.data_plugins import plugin_modules, add_plugin | ||
import pydm | ||
import pytest | ||
import numpy as np | ||
import pandas as pd | ||
from ophyd import DynamicDeviceComponent as DDC | ||
from ophyd import Kind | ||
from ophyd.sim import ( | ||
|
@@ -21,18 +15,14 @@ | |
instantiate_fake_device, | ||
make_fake_device, | ||
) | ||
from pytestqt.qt_compat import qt_api | ||
from tiled.adapters.mapping import MapAdapter | ||
from tiled.adapters.xarray import DatasetAdapter | ||
from tiled.adapters.table import TableAdapter | ||
from tiled.client import Context, from_context | ||
from tiled.server.app import build_app | ||
|
||
|
||
import haven | ||
from firefly.application import FireflyApplication | ||
from firefly.main_window import FireflyMainWindow | ||
from haven._iconfig import beamline_connected as _beamline_connected | ||
from haven.catalog import Catalog | ||
from haven.instrument.aerotech import AerotechStage | ||
from haven.instrument.aps import ApsMachine | ||
from haven.instrument.camera import AravisDetector | ||
|
@@ -45,7 +35,6 @@ | |
from haven.instrument.slits import ApertureSlits, BladeSlits | ||
from haven.instrument.xspress import Xspress3Detector | ||
from haven.instrument.xspress import add_mcas as add_xspress_mcas | ||
from haven.catalog import Catalog | ||
|
||
top_dir = Path(__file__).parent.resolve() | ||
haven_dir = top_dir / "haven" | ||
|
@@ -288,7 +277,7 @@ def shutters(sim_registry): | |
|
||
grid_scan = pd.DataFrame( | ||
{ | ||
'CdnIPreKb': np.linspace(0, 104, num=105), | ||
"CdnIPreKb": np.linspace(0, 104, num=105), | ||
"It_net_counts": np.linspace(0, 104, num=105), | ||
"aerotech_horiz": np.linspace(0, 104, num=105), | ||
"aerotech_vert": np.linspace(0, 104, num=105), | ||
|
@@ -341,26 +330,36 @@ def shutters(sim_registry): | |
"primary": MapAdapter( | ||
{ | ||
"data": DatasetAdapter.from_dataset(grid_scan), | ||
}, metadata={ | ||
"descriptors": [{"hints": {'Ipreslit': {'fields': ['Ipreslit_net_counts']}, | ||
'CdnIPreKb': {'fields': ['CdnIPreKb_net_counts']}, | ||
'I0': {'fields': ['I0_net_counts']}, | ||
'CdnIt': {'fields': ['CdnIt_net_counts']}, | ||
'aerotech_vert': {'fields': ['aerotech_vert']}, | ||
'aerotech_horiz': {'fields': ['aerotech_horiz']}, | ||
'Ipre_KB': {'fields': ['Ipre_KB_net_counts']}, | ||
'CdnI0': {'fields': ['CdnI0_net_counts']}, | ||
'It': {'fields': ['It_net_counts']}}}] | ||
}), | ||
}, | ||
metadata={ | ||
"descriptors": [ | ||
{ | ||
"hints": { | ||
"Ipreslit": {"fields": ["Ipreslit_net_counts"]}, | ||
"CdnIPreKb": {"fields": ["CdnIPreKb_net_counts"]}, | ||
"I0": {"fields": ["I0_net_counts"]}, | ||
"CdnIt": {"fields": ["CdnIt_net_counts"]}, | ||
"aerotech_vert": {"fields": ["aerotech_vert"]}, | ||
"aerotech_horiz": {"fields": ["aerotech_horiz"]}, | ||
"Ipre_KB": {"fields": ["Ipre_KB_net_counts"]}, | ||
"CdnI0": {"fields": ["CdnI0_net_counts"]}, | ||
"It": {"fields": ["It_net_counts"]}, | ||
} | ||
} | ||
] | ||
}, | ||
), | ||
}, | ||
metadata={ | ||
"start": { | ||
"plan_name": "grid_scan", | ||
"uid": "85573831-f4b4-4f64-b613-a6007bf03a8d", | ||
"hints": { | ||
'dimensions': [[['aerotech_vert'], 'primary'], | ||
[['aerotech_horiz'], 'primary']], | ||
'gridding': 'rectilinear' | ||
"dimensions": [ | ||
[["aerotech_vert"], "primary"], | ||
[["aerotech_horiz"], "primary"], | ||
], | ||
"gridding": "rectilinear", | ||
}, | ||
"shape": [5, 21], | ||
"extents": [[-80, 80], [-100, 100]], | ||
|
@@ -390,7 +389,6 @@ def catalog(tiled_client): | |
return Catalog(client=tiled_client) | ||
|
||
|
||
|
||
# ----------------------------------------------------------------------------- | ||
# :author: Mark Wolfman | ||
# :email: [email protected] | ||
|
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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import asyncio | ||
import logging | ||
import subprocess | ||
from collections import OrderedDict | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import asyncio | ||
import argparse | ||
import asyncio | ||
import cProfile | ||
import logging | ||
import pstats | ||
|
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 |
---|---|---|
@@ -1,21 +1,20 @@ | ||
import asyncio | ||
import datetime as dt | ||
import logging | ||
from collections import OrderedDict | ||
from typing import Sequence, Mapping | ||
from typing import Mapping, Sequence | ||
|
||
from qtpy.QtCore import QObject, Signal, Slot | ||
from tiled import queries | ||
import pandas as pd | ||
import numpy as np | ||
import pandas as pd | ||
from qtpy.QtCore import Signal | ||
from tiled import queries | ||
|
||
from haven.catalog import Catalog | ||
from haven import exceptions | ||
from haven.catalog import Catalog | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class DatabaseWorker(): | ||
class DatabaseWorker: | ||
selected_runs: Sequence = [] | ||
|
||
# Signals | ||
|
@@ -50,7 +49,9 @@ async def filtered_nodes(self, filters: Mapping): | |
for filter_name, Query, md_name in filter_params: | ||
val = filters.get(filter_name, "") | ||
if val != "": | ||
runs = await runs.search(Query(md_name, val, case_sensitive=case_sensitive)) | ||
runs = await runs.search( | ||
Query(md_name, val, case_sensitive=case_sensitive) | ||
) | ||
full_text = filters.get("full_text", "") | ||
if full_text != "": | ||
runs = await runs.search( | ||
|
@@ -203,7 +204,15 @@ async def all_signals(self, hinted_only=False): | |
dfs[run.uid] = df | ||
return dfs | ||
|
||
async def signals(self, x_signal, y_signal, r_signal=None, use_log=False, use_invert=False, use_grad=False) -> Mapping: | ||
async def signals( | ||
self, | ||
x_signal, | ||
y_signal, | ||
r_signal=None, | ||
use_log=False, | ||
use_invert=False, | ||
use_grad=False, | ||
) -> Mapping: | ||
"""Produce a dictionary with the 1D datasets for plotting. | ||
The keys of the dictionary are the labels for each curve, and | ||
|
@@ -214,8 +223,10 @@ async def signals(self, x_signal, y_signal, r_signal=None, use_log=False, use_in | |
# Check for sensible inputs | ||
use_reference = r_signal is not None | ||
if "" in [x_signal, y_signal] or (use_reference and r_signal == ""): | ||
msg = (f"Empty signal name requested: x={repr(x_signal)}, y={repr(y_signal)}," | ||
f" r={repr(r_signal)}") | ||
msg = ( | ||
f"Empty signal name requested: x={repr(x_signal)}, y={repr(y_signal)}," | ||
f" r={repr(r_signal)}" | ||
) | ||
log.debug(msg) | ||
raise exceptions.EmptySignalName(msg) | ||
signals = [x_signal, y_signal] | ||
|
@@ -233,7 +244,9 @@ async def signals(self, x_signal, y_signal, r_signal=None, use_log=False, use_in | |
missing_y = y_signal not in df.columns | ||
missing_r = r_signal not in df.columns | ||
if missing_x or missing_y or (use_reference and missing_r): | ||
log.warning("Could not find signals {x_signal}, {y_signal} and {r_signal}") | ||
log.warning( | ||
"Could not find signals {x_signal}, {y_signal} and {r_signal}" | ||
) | ||
continue | ||
# Apply transformations | ||
if use_reference: | ||
|
@@ -248,6 +261,7 @@ async def signals(self, x_signal, y_signal, r_signal=None, use_log=False, use_in | |
dfs[run.uid] = series | ||
return dfs | ||
|
||
|
||
# ----------------------------------------------------------------------------- | ||
# :author: Mark Wolfman | ||
# :email: [email protected] | ||
|
Oops, something went wrong.