labdata 0.1.26__tar.gz → 0.1.27__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {labdata-0.1.26 → labdata-0.1.27}/PKG-INFO +1 -1
  2. {labdata-0.1.26 → labdata-0.1.27}/labdata/__init__.py +1 -1
  3. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/compute.py +12 -6
  4. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/ephys/recordings.py +3 -0
  5. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/imaging.py +3 -1
  6. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/index.py +12 -8
  7. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/notes.py +3 -0
  8. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/procedures.py +3 -0
  9. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/reads.py +38 -1
  10. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/segmentation.py +7 -3
  11. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/sync.py +3 -0
  12. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/upload.py +12 -4
  13. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/video.py +6 -3
  14. {labdata-0.1.26 → labdata-0.1.27}/labdata.egg-info/PKG-INFO +1 -1
  15. {labdata-0.1.26 → labdata-0.1.27}/LICENSE +0 -0
  16. {labdata-0.1.26 → labdata-0.1.27}/README.md +0 -0
  17. {labdata-0.1.26 → labdata-0.1.27}/labdata/accounts.py +0 -0
  18. {labdata-0.1.26 → labdata-0.1.27}/labdata/cli.py +0 -0
  19. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/__init__.py +0 -0
  20. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/caiman.py +0 -0
  21. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/ec2.py +0 -0
  22. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/ephys.py +0 -0
  23. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/pcluster.py +0 -0
  24. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/pose.py +0 -0
  25. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/schedulers.py +0 -0
  26. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/singularity.py +0 -0
  27. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/spikeinterface.py +0 -0
  28. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/submission.py +0 -0
  29. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/suite2p.py +0 -0
  30. {labdata-0.1.26 → labdata-0.1.27}/labdata/compute/utils.py +0 -0
  31. {labdata-0.1.26 → labdata-0.1.27}/labdata/copy.py +0 -0
  32. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/__init__.py +0 -0
  33. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/activity.py +0 -0
  34. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/admin.py +0 -0
  35. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/ai_utils.py +0 -0
  36. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/console.py +0 -0
  37. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/decisiontask.py +0 -0
  38. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/docstrings.py +0 -0
  39. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/ephys/__init__.py +0 -0
  40. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/ephys/drift.py +0 -0
  41. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/ephys/raster.py +0 -0
  42. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/ephys/sorting.py +0 -0
  43. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/events.py +0 -0
  44. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/launch.py +0 -0
  45. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/local_files.py +0 -0
  46. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/schema_graph.py +0 -0
  47. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/upload_worker.py +0 -0
  48. {labdata-0.1.26 → labdata-0.1.27}/labdata/dashboard/writes.py +0 -0
  49. {labdata-0.1.26 → labdata-0.1.27}/labdata/ephys_io.py +0 -0
  50. {labdata-0.1.26 → labdata-0.1.27}/labdata/ephys_signal.py +0 -0
  51. {labdata-0.1.26 → labdata-0.1.27}/labdata/export/__init__.py +0 -0
  52. {labdata-0.1.26 → labdata-0.1.27}/labdata/export/database.py +0 -0
  53. {labdata-0.1.26 → labdata-0.1.27}/labdata/export/docker/Dockerfile.in +0 -0
  54. {labdata-0.1.26 → labdata-0.1.27}/labdata/export/docker/entrypoint.sh +0 -0
  55. {labdata-0.1.26 → labdata-0.1.27}/labdata/export/docker/load_database.sh +0 -0
  56. {labdata-0.1.26 → labdata-0.1.27}/labdata/export/docker/mysql.cnf +0 -0
  57. {labdata-0.1.26 → labdata-0.1.27}/labdata/export/docker.py +0 -0
  58. {labdata-0.1.26 → labdata-0.1.27}/labdata/export/selection.py +0 -0
  59. {labdata-0.1.26 → labdata-0.1.27}/labdata/export/share.py +0 -0
  60. {labdata-0.1.26 → labdata-0.1.27}/labdata/export/users.py +0 -0
  61. {labdata-0.1.26 → labdata-0.1.27}/labdata/rules/__init__.py +0 -0
  62. {labdata-0.1.26 → labdata-0.1.27}/labdata/rules/ephys.py +0 -0
  63. {labdata-0.1.26 → labdata-0.1.27}/labdata/rules/imaging.py +0 -0
  64. {labdata-0.1.26 → labdata-0.1.27}/labdata/rules/utils.py +0 -0
  65. {labdata-0.1.26 → labdata-0.1.27}/labdata/s3.py +0 -0
  66. {labdata-0.1.26 → labdata-0.1.27}/labdata/schema/__init__.py +0 -0
  67. {labdata-0.1.26 → labdata-0.1.27}/labdata/schema/ephys.py +0 -0
  68. {labdata-0.1.26 → labdata-0.1.27}/labdata/schema/general.py +0 -0
  69. {labdata-0.1.26 → labdata-0.1.27}/labdata/schema/histology.py +0 -0
  70. {labdata-0.1.26 → labdata-0.1.27}/labdata/schema/onephoton.py +0 -0
  71. {labdata-0.1.26 → labdata-0.1.27}/labdata/schema/procedures.py +0 -0
  72. {labdata-0.1.26 → labdata-0.1.27}/labdata/schema/tasks.py +0 -0
  73. {labdata-0.1.26 → labdata-0.1.27}/labdata/schema/twophoton.py +0 -0
  74. {labdata-0.1.26 → labdata-0.1.27}/labdata/schema/utils.py +0 -0
  75. {labdata-0.1.26 → labdata-0.1.27}/labdata/schema/video.py +0 -0
  76. {labdata-0.1.26 → labdata-0.1.27}/labdata/stacks.py +0 -0
  77. {labdata-0.1.26 → labdata-0.1.27}/labdata/utils.py +0 -0
  78. {labdata-0.1.26 → labdata-0.1.27}/labdata/widgets.py +0 -0
  79. {labdata-0.1.26 → labdata-0.1.27}/labdata.egg-info/SOURCES.txt +0 -0
  80. {labdata-0.1.26 → labdata-0.1.27}/labdata.egg-info/dependency_links.txt +0 -0
  81. {labdata-0.1.26 → labdata-0.1.27}/labdata.egg-info/entry_points.txt +0 -0
  82. {labdata-0.1.26 → labdata-0.1.27}/labdata.egg-info/requires.txt +0 -0
  83. {labdata-0.1.26 → labdata-0.1.27}/labdata.egg-info/top_level.txt +0 -0
  84. {labdata-0.1.26 → labdata-0.1.27}/pyproject.toml +0 -0
  85. {labdata-0.1.26 → labdata-0.1.27}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labdata
3
- Version: 0.1.26
3
+ Version: 0.1.27
4
4
  Summary: Package to manage data in experimental neuroscience labs
5
5
  Author-email: Joao Couto <jpcouto@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/jcouto/labdata
@@ -1,4 +1,4 @@
1
- VERSION = "0.1.26"
1
+ VERSION = "0.1.27"
2
2
  __version__ = VERSION
3
3
 
4
4
  from .utils import *
@@ -2,6 +2,7 @@ import pandas as pd
2
2
  import numpy as np
3
3
  import streamlit as st
4
4
  from writes import write, show_flash, log
5
+ from reads import cached_reads, refresh_button
5
6
 
6
7
  STATES = ['COMPLETED', 'WORKING', 'WAITING', 'FAILED', 'CANCELED','ON SERVER']
7
8
  STATE_COLORS = ['#01D186', '#48CAE4', '#F3A21C', '#FF5733', '#F3A21C','#F3A21C']
@@ -354,7 +355,8 @@ def compute_tab(schema=None):
354
355
  The Queue view displays job counts by status, an interactive table of the
355
356
  compute tasks, and controls to resubmit or delete them. The Launch view
356
357
  submits tasks of any analysis with ``labdata.compute.submit`` (see
357
- ``launch.launch_view``).
358
+ ``launch.launch_view``). **Refresh**, next to the views, reads the queue
359
+ again with its log entries, and the analyses that can be launched.
358
360
 
359
361
  Parameters
360
362
  ----------
@@ -366,11 +368,15 @@ def compute_tab(schema=None):
366
368
  schema = load_project_schema()
367
369
 
368
370
  from functools import partial
369
- from launch import launch_view
370
- views = {'Queue': partial(_queue_view, schema), 'Launch': partial(launch_view, schema)}
371
- active = st.segmented_control('view', list(views), default='Queue',
372
- selection_mode='single', key='compute_active_tab',
373
- label_visibility='collapsed')
371
+ import launch
372
+ views = {'Queue': partial(_queue_view, schema), 'Launch': partial(launch.launch_view, schema)}
373
+ with st.container(horizontal=True, vertical_alignment='center'):
374
+ active = st.segmented_control('view', list(views), default='Queue',
375
+ selection_mode='single', key='compute_active_tab',
376
+ label_visibility='collapsed')
377
+ # the queue is read on every run; a refresh draws its new jobs and log entries, with the
378
+ # selection and edits of the job table cleared, since its rows can change
379
+ refresh_button('compute_refresh', cached_reads(vars(launch)), reset=('compute_editor',))
374
380
  views.get(active, views['Queue'])() # segmented_control can return None
375
381
 
376
382
 
@@ -6,6 +6,7 @@ import streamlit as st
6
6
  import numpy as np
7
7
  import plotly.graph_objects as go
8
8
  from writes import log
9
+ from reads import refresh_button, cached_reads
9
10
  from reads import (STACK_URL_LIFETIME, parse_frame_numbers, read_from, read_source, read_file, drop_stale_notice,
10
11
  show_read_notices, held_open, drop_held)
11
12
  from labdata.ephys_signal import (to_microvolts, notch_60, bandpass, minmax_decimate, spectrogram_db, coherence_pairs,
@@ -530,6 +531,8 @@ def ephys_tab(schema=None):
530
531
  'positive when it leads. The shaded band is the one averaged in the heatmaps.')
531
532
 
532
533
  # ---------------- the page ----------------
534
+ with st.container(horizontal=True, horizontal_alignment='right'):
535
+ refresh_button('ephys_refresh', cached_reads(locals()))
533
536
  subjects = get_subjects()
534
537
  if subjects.empty:
535
538
  st.write('No electrophysiology recording in the database.')
@@ -5,6 +5,7 @@ import streamlit as st
5
5
  import numpy as np
6
6
  from pathlib import Path
7
7
  from writes import log
8
+ from reads import cached_reads, refresh_button
8
9
  from reads import (FRAME_GRAB_MAX, STACK_KINDS, STACK_URL_LIFETIME, parse_frame_numbers, read_from, read_source, read_file,
9
10
  drop_stale_notice, show_read_notices, stack_records, open_stack, stack_axes, stack_caption, show_frames, held_chunk,
10
11
  keep_clip, drop_clip)
@@ -208,13 +209,14 @@ def imaging_tab(schema=None):
208
209
  if not kinds:
209
210
  st.write('No imaging recording in the database.')
210
211
  return
211
- c_kind, c_part = st.columns([3, 2])
212
+ c_kind, c_part, c_refresh = st.columns([3, 2, 1], vertical_alignment='center')
212
213
  kind = c_kind.segmented_control('Imaging', kinds, default=kinds[0], key='imaging_kind',
213
214
  label_visibility='collapsed') or kinds[0]
214
215
  parts = {'Display clip': _clip_view, 'Frames': _frames_view}
215
216
  part = c_part.segmented_control('Show', list(parts), default='Display clip', key='imaging_part',
216
217
  label_visibility='collapsed',
217
218
  help='Both parts read the stack where it is, local copy or S3, and only when their button is pressed.')
219
+ refresh_button('imaging_refresh', cached_reads(locals()), c_refresh.container(horizontal_alignment='right'))
218
220
  col1, col2 = st.columns([1, 5])
219
221
  col1.write('### Subjects')
220
222
  edited = col1.data_editor(get_subjects(kind), hide_index=False, disabled=['subject_name'], key=f'imaging_subjects_{kind}')
@@ -60,8 +60,20 @@ def intro_tab(user_name=None, schema=None):
60
60
  '''Fetch all strain names.'''
61
61
  return list(schema.Strain().fetch('strain_name'))
62
62
 
63
+ @st.cache_data
64
+ def get_weighings(subject_name):
65
+ '''Fetch the weighings of a subject, oldest first.'''
66
+ rows = (schema.Weighing & dict(subject_name=subject_name)).fetch(
67
+ 'subject_name', 'weighing_datetime', 'weight', as_dict=True)
68
+ if not rows:
69
+ return pd.DataFrame(columns=['subject_name', 'weighing_datetime', 'weight'])
70
+ return pd.DataFrame(rows).sort_values('weighing_datetime').reset_index(drop=True)
71
+
63
72
  from writes import write, show_flash, log, archived_notice
73
+ from reads import refresh_button, cached_reads
64
74
  from labdata.s3 import FilesArchivedError
75
+ with st.container(horizontal=True, horizontal_alignment='right'):
76
+ refresh_button('subjects_refresh', cached_reads(locals()))
65
77
  show_flash('subjects_msg')
66
78
  list_tab, add_tab, edit_tab, weighing_tab = st.tabs(['Subjects/Sessions', 'New', 'Update', 'Weighing'])
67
79
 
@@ -218,14 +230,6 @@ def intro_tab(user_name=None, schema=None):
218
230
  st.rerun()
219
231
 
220
232
  with weighing_tab:
221
- @st.cache_data
222
- def get_weighings(subject_name):
223
- rows = (schema.Weighing & dict(subject_name=subject_name)).fetch(
224
- 'subject_name', 'weighing_datetime', 'weight', as_dict=True)
225
- if not rows:
226
- return pd.DataFrame(columns=['subject_name', 'weighing_datetime', 'weight'])
227
- return pd.DataFrame(rows).sort_values('weighing_datetime').reset_index(drop=True)
228
-
229
233
  subjects = get_subjects()
230
234
  all_subject_names = list(subjects['subject_name'])
231
235
  preselected = st.session_state.get('subjects_selected', [])
@@ -2,6 +2,7 @@ import pandas as pd
2
2
  import streamlit as st
3
3
  from datetime import datetime, date, time as dtime
4
4
  from writes import write
5
+ from reads import refresh_button, cached_reads
5
6
 
6
7
 
7
8
  def notes_tab(schema=None):
@@ -61,6 +62,8 @@ def notes_tab(schema=None):
61
62
  users = get_users()
62
63
  subjects = get_subjects()
63
64
 
65
+ with st.container(horizontal=True, horizontal_alignment='right'):
66
+ refresh_button('notes_refresh', cached_reads(locals()))
64
67
  browse_tab, update_tab, add_tab = st.tabs(['Browse', 'Update', 'Create'])
65
68
 
66
69
  def _render_notes_table(notes_df, editor_key):
@@ -2,6 +2,7 @@ import pandas as pd
2
2
  import streamlit as st
3
3
  from datetime import datetime
4
4
  from writes import write, show_flash
5
+ from reads import refresh_button, cached_reads
5
6
 
6
7
  ADD_KINDS = ['Procedure', 'Probe insertion', 'Probe extraction', 'Euthanasia']
7
8
  NEW_PROCEDURE = 'New procedure'
@@ -346,6 +347,8 @@ def procedures_tab(schema=None):
346
347
  return df[(df['subject_name'] == key['subject_name'])
347
348
  & (df['procedure_type'] == key['procedure_type']) & same_time]
348
349
 
350
+ with st.container(horizontal=True, horizontal_alignment='right'):
351
+ refresh_button('procedures_refresh', cached_reads(locals()))
349
352
  browse_tab, add_tab = st.tabs(['Browse', 'Add'])
350
353
 
351
354
  with browse_tab:
@@ -1,4 +1,4 @@
1
- '''Reads of files in storage from the dashboard: frame numbers, the read source and the notices a failed read leaves.'''
1
+ '''Reads from the dashboard: the Refresh of a tab's cached reads, and reads of files in storage with their frame numbers, read source and the notices a failed read leaves.'''
2
2
  import atexit
3
3
  import time
4
4
  import weakref
@@ -20,6 +20,43 @@ STACK_KINDS = {'Two-photon': dict(table='TwoPhoton', chunk=128, planes=True, cha
20
20
  'Fixed brain': dict(table='FixedBrain', chunk=4, planes=False, channels=True)}
21
21
 
22
22
 
23
+ def cached_reads(*namespaces):
24
+ '''Return the ``st.cache_data`` functions held in ``namespaces``, dicts such as a tab's ``locals()`` or ``vars(module)``.
25
+
26
+ Functions cached with ``st.cache_resource``, such as connections, are left
27
+ out.
28
+ '''
29
+ found = []
30
+ for namespace in namespaces:
31
+ for value in namespace.values():
32
+ cache_type = getattr(getattr(value, '_info', None), 'cache_type', None)
33
+ if (type(value).__name__ == 'CachedFunc' and getattr(cache_type, 'name', 'DATA') == 'DATA'
34
+ and not any(value is f for f in found)):
35
+ found.append(value)
36
+ return found
37
+
38
+
39
+ def refresh_button(key, caches, where=None, reset=()):
40
+ '''Draw a Refresh button under ``where``, a container or the page, that clears ``caches`` and draws the tab again.
41
+
42
+ ``caches`` are the cached reads of the tab, as ``cached_reads`` finds
43
+ them; ``reset`` names session state to drop with them, such as the
44
+ selection of a table whose rows the refresh can change. The refresh goes
45
+ to the activity log, and a toast confirms it on the run that follows.
46
+ '''
47
+ target = st if where is None else where
48
+ if st.session_state.pop(f'_{key}_done', False):
49
+ st.toast('Read the database again.', icon=':material/refresh:')
50
+ if target.button('Refresh', icon=':material/refresh:', key=key, help='Read the database again.'):
51
+ for cached in caches:
52
+ cached.clear()
53
+ for name in reset:
54
+ st.session_state.pop(name, None)
55
+ log(f'read the database again ({len(caches)} cached reads cleared)')
56
+ st.session_state[f'_{key}_done'] = True
57
+ st.rerun()
58
+
59
+
23
60
  def known_number(value):
24
61
  '''Return ``value`` as a float when it is a positive finite number, else None.
25
62
 
@@ -5,9 +5,11 @@ import streamlit as st
5
5
  import numpy as np
6
6
  from pathlib import Path
7
7
  from writes import write, show_flash, log
8
+ from reads import cached_reads, refresh_button
8
9
  from reads import (STACK_KINDS, known_number, read_from, read_source, read_file, drop_stale_notice, show_read_notices, stack_records,
9
10
  open_stack, stack_caption, held_chunk, keep_clip, drop_clip)
10
11
  from labdata.stacks import clip_info, write_clip
12
+ import activity
11
13
  from activity import activity_section
12
14
 
13
15
  MAX_PLOT = 5
@@ -1679,7 +1681,9 @@ def segmentation_tab(schema=None):
1679
1681
  'Explore and curate ROIs': _explorer_view,
1680
1682
  'Movie': _movie_view}
1681
1683
  default = 'Sessions'
1682
- active = st.segmented_control('view', list(views), default=default,
1683
- selection_mode='single', key='seg_active_view',
1684
- label_visibility='collapsed')
1684
+ with st.container(horizontal=True, vertical_alignment='center'):
1685
+ active = st.segmented_control('view', list(views), default=default,
1686
+ selection_mode='single', key='seg_active_view',
1687
+ label_visibility='collapsed')
1688
+ refresh_button('seg_refresh', cached_reads(locals(), vars(activity)))
1685
1689
  views.get(active, views[default])() # segmented_control can return None
@@ -4,6 +4,7 @@ import pandas as pd
4
4
  import streamlit as st
5
5
  import plotly.graph_objects as go
6
6
  from writes import write, log, show_flash
7
+ from reads import refresh_button, cached_reads
7
8
  from events import synced_events, SYNC_FIELDS
8
9
 
9
10
  STREAM_COLOURS = ['#000000', '#d62728', '#1f77b4', '#2ca02c', '#ff7f0e', '#9467bd', '#8c564b', '#e377c2', '#17becf', '#bcbd22']
@@ -421,6 +422,8 @@ def sync_tab(schema=None):
421
422
  st.rerun()
422
423
 
423
424
  # ---------------- the page ----------------
425
+ with st.container(horizontal=True, horizontal_alignment='right'):
426
+ refresh_button('sync_refresh', cached_reads(locals()))
424
427
  subjects = get_subjects()
425
428
  if subjects.empty:
426
429
  st.write('No digital events in the database.')
@@ -1,7 +1,9 @@
1
1
  import streamlit as st
2
2
  from functools import partial
3
+ import local_files
3
4
  from compute import _jobs_panel
4
5
  from local_files import local_files_tab
6
+ from reads import cached_reads, refresh_button
5
7
 
6
8
  # UploadJob columns that can be edited in the table and saved
7
9
  EDITABLE = ['job_status', 'job_host', 'job_rule', 'job_waiting', 'job_log',
@@ -15,7 +17,9 @@ def upload_tab(schema=None):
15
17
  upload jobs (changed cells are written back with a save button), and
16
18
  controls to delete jobs or reset them to ON SERVER. The Local files view
17
19
  browses ``prefs['local_paths']`` and sends folders to the queue (see
18
- ``local_files.local_files_tab``).
20
+ ``local_files.local_files_tab``). **Refresh**, next to the views, reads
21
+ the queue again with its log entries, and the database records of the
22
+ local files.
19
23
 
20
24
  Parameters
21
25
  ----------
@@ -27,9 +31,13 @@ def upload_tab(schema=None):
27
31
  schema = load_project_schema()
28
32
 
29
33
  views = {'Queue': partial(_queue_view, schema), 'Local files': partial(local_files_tab, schema)}
30
- active = st.segmented_control('view', list(views), default='Queue',
31
- selection_mode='single', key='upload_active_tab',
32
- label_visibility='collapsed')
34
+ with st.container(horizontal=True, vertical_alignment='center'):
35
+ active = st.segmented_control('view', list(views), default='Queue',
36
+ selection_mode='single', key='upload_active_tab',
37
+ label_visibility='collapsed')
38
+ # the queue is read on every run; a refresh draws its new jobs and log entries, with the
39
+ # selection and unsaved edits of the job table cleared, since its rows can change
40
+ refresh_button('upload_refresh', cached_reads(vars(local_files)), reset=('upload_editor',))
33
41
  views.get(active, views['Queue'])() # segmented_control can return None
34
42
 
35
43
 
@@ -3,6 +3,7 @@ import streamlit as st
3
3
  from pathlib import Path
4
4
  import numpy as np
5
5
  from writes import write, transaction, log, archived_notice, show_flash
6
+ from reads import cached_reads, refresh_button
6
7
  from reads import (FRAME_GRAB_MAX, known_number, parse_frame_numbers, read_from, read_source, read_file, drop_stale_notice,
7
8
  show_read_notices, keep_clip, drop_clip, window_cache_get, window_cache_put)
8
9
  from labdata.s3 import FilesArchivedError
@@ -1220,7 +1221,9 @@ def video_tab(schema=None):
1220
1221
  'Add Frames': _add_frames_view,
1221
1222
  'Browse Videos': _browse_videos_view}
1222
1223
  default = 'Label Sets'
1223
- active = st.segmented_control('view', list(views), default=default,
1224
- selection_mode='single', key='video_active_tab',
1225
- label_visibility='collapsed')
1224
+ with st.container(horizontal=True, vertical_alignment='center'):
1225
+ active = st.segmented_control('view', list(views), default=default,
1226
+ selection_mode='single', key='video_active_tab',
1227
+ label_visibility='collapsed')
1228
+ refresh_button('video_refresh', cached_reads(locals()))
1226
1229
  views.get(active, views[default])() # segmented_control can return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labdata
3
- Version: 0.1.26
3
+ Version: 0.1.27
4
4
  Summary: Package to manage data in experimental neuroscience labs
5
5
  Author-email: Joao Couto <jpcouto@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/jcouto/labdata
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes