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
3 changes: 1 addition & 2 deletions src/deeranalysis/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from deeranalysis.components.setup_modal_desktop import create_setup_modal, get_DeerAnalysis_directory
from deeranalysis.components.new_version_modal import new_version_modal, update_button
from deeranalysis.components.dmc_theme import da_dmctheme
from deeranalysis.utils.logs_plugin import initialize_logs_api,check_logs_api_key
from deeranalysis.utils.logs_plugin import initialize_logs_api
from deeranalysis.utils.database import get_appearance_settings
from deeranalysis.utils.deerlab_options import resolve_plot_template

Expand Down Expand Up @@ -80,7 +80,6 @@ def create_nav_link(label, href, icon):
[
dmc.Text("Datasets", size="sm", c="dimmed", fw=500),
create_nav_link("File Import", "/upload", "mdi:upload"),
*( [create_nav_link("Logs Import", "/logs_upload", "mdi:file-document-outline")] if check_logs_api_key() else [] ),
create_nav_link("Datasets", "/", "mdi:database"),
create_nav_link("Comparison", "/comparison", "mdi:compare"),

Expand Down
452 changes: 452 additions & 0 deletions src/deeranalysis/components/batch_import.py

Large diffs are not rendered by default.

55 changes: 32 additions & 23 deletions src/deeranalysis/components/dataset_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,9 @@ def update_delays(_, delays_row_data, dataset_store):
# ---------------------------------------------------------------------------
# Store / experiment type change → check tmin plausibility
# ---------------------------------------------------------------------------
@callback(
Output({'type': 'tmin-warning-div', 'page': MATCH}, 'children'),
Input({'type': 'dataset-store', 'page': MATCH}, 'data'),
Input({'type': 'experiment-type-dropdown', 'page': MATCH}, 'value'),
prevent_initial_call=True,
)
def check_tmin(store, exp_type):
def check_tmin_warning(store, exp_type):
"""Returns a warning message string if tmin looks wrong for the given
experiment type, or None if the delays/data are plausible."""
if store is None:
return None
delays = store.get('delays', {})
Expand All @@ -98,29 +94,31 @@ def check_tmin(store, exp_type):
threshold = 50 / 1e3

if abs(peak_time - data_max_time) > threshold:
return dmc.Alert(
title="Warning: tmin may be incorrect",
children=(
f"The expected peak time based on delays is {peak_time * 1e3:.0f} ns, "
f"but the data maximum is at {data_max_time * 1e3:.0f} ns. "
"Please check that tmin is set correctly."
),
color="yellow",
mb="md",
return (
f"The expected peak time based on delays is {peak_time * 1e3:.0f} ns, "
f"but the data maximum is at {data_max_time * 1e3:.0f} ns. "
"Please check that tmin is set correctly."
)
return None


@callback(
Output({'type': 'tmin-warning-div', 'page': MATCH}, 'children'),
Input({'type': 'dataset-store', 'page': MATCH}, 'data'),
Input({'type': 'experiment-type-dropdown', 'page': MATCH}, 'value'),
prevent_initial_call=True,
)
def check_tmin(store, exp_type):
message = check_tmin_warning(store, exp_type)
if message:
return dmc.Alert(title="Warning: tmin may be incorrect", children=message, color="yellow", mb="md")
return None


# ---------------------------------------------------------------------------
# Populate project / sample autocomplete options from the database
# ---------------------------------------------------------------------------
@callback(
Output({'type': 'project-name', 'page': MATCH}, 'data'),
Output({'type': 'sample-name', 'page': MATCH}, 'data'),
Input({'type': 'project-name', 'page': MATCH}, 'n_clicks'),
prevent_initial_call=False,
)
def update_projects_and_samples(_n_clicks):
def get_projects_and_samples():
session = get_session()
datasets = session.query(Dataset).all()
session.close()
Expand All @@ -129,6 +127,17 @@ def update_projects_and_samples(_n_clicks):
return projects, samples


@callback(
Output({'type': 'project-name', 'page': MATCH}, 'data'),
Output({'type': 'sample-name', 'page': MATCH}, 'data'),
Input({'type': 'project-name', 'page': MATCH}, 'n_blur'),
Input({'type': 'sample-name', 'page': MATCH}, 'n_blur'),
prevent_initial_call=False,
)
def update_projects_and_samples(_project_blur, _sample_blur):
return get_projects_and_samples()


# ---------------------------------------------------------------------------
# Save dataset to database and reset the form
# ---------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/deeranalysis/components/logs_import_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def _build_signal_figure(dataset_store, correct_phase, masking_enabled):


@callback(
Output({"type": "metadata-value-modal", 'page': page_id}, "opened"),
Output({"type": "metadata-value-modal-text", 'page': page_id}, "value"),
Output({"type": "metadata-value-modal", 'page': page_id}, "opened", allow_duplicate=True),
Output({"type": "metadata-value-modal-text", 'page': page_id}, "value", allow_duplicate=True),
Input({"type": "metadata-show-btn", "key": dash.ALL}, "n_clicks"),
State({"type": "metadata-modal-store", "page": page_id}, "data"),
prevent_initial_call=True,
Expand Down
Loading
Loading