Skip to content
Open
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: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ dev = [
[project.scripts]
cala = "cala.main:cli"

[project.entry-points."noob.add_sources"]
tubes = "cala.hooks:add_noob_sources"

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
Expand Down
212 changes: 212 additions & 0 deletions src/cala/data/long_recording.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
noob_id: long-recording
noob_model: noob.tube.TubeSpecification
noob_version: 0.1.1.dev118+g64d81b7

assets:
buffer:
type: cala.arrays.Buffer
params:
size: 100
scope: runner
footprints:
type: cala.arrays.Footprints
params:
sparsify: True
scope: runner
traces:
type: cala.arrays.Traces
scope: runner
params:
zarr_path: traces/
peek_size: 100
flush_interval: 1000
pix_stats:
type: cala.arrays.PixStats
scope: runner
comp_stats:
type: cala.arrays.CompStats
scope: runner
overlaps:
type: cala.arrays.Overlaps
scope: runner
residuals:
type: cala.arrays.Buffer
params:
size: 100
scope: runner


nodes:
source:
type: cala.nodes.io.stream
params:
subdir: long_recording
extension: .avi
counter:
type: cala.nodes.prep.counter
frame:
type: cala.nodes.prep.package_frame
depends:
- frame: source.value
- index: counter.idx

#PREPROCESS BEGINS
hotpix:
type: cala.nodes.prep.blur
params:
method: median
kwargs:
ksize: 3
depends:
- frame: frame.value
flatten:
type: cala.nodes.prep.butter
params:
kwargs:
cutoff_frequency_ratio: 0.010
depends:
- frame: hotpix.frame
lines:
type: cala.nodes.prep.remove_mean
params:
orient: both
depends:
- frame: flatten.frame
motion:
type: cala.nodes.prep.Anchor
depends:
- frame: lines.frame
glow:
type: cala.nodes.prep.GlowRemover
depends:
- frame: motion.frame
gather:
type: gather
params:
n: 4
depends:
- glow.frame
downsample: # 20fps -> 5fps
type: cala.nodes.prep.downsample
params:
x_range: [ 250, 350 ]
y_range: [ 250, 350 ]
t_downsample: 4
depends:
- frames: gather.value
size_est:
type: cala.nodes.prep.SizeEst
params:
hardset_radius: 8
depends:
- frame: downsample.frame
cache:
type: cala.nodes.omf.pixel_stats.fill_buffer
depends:
- buffer: assets.buffer
- frame: downsample.frame
#PREPROCESS ENDS

# FRAME UPDATE BEGINS
trace_frame:
type: cala.nodes.omf.traces.Tracer
params:
tol: 0.001
max_iter: 100
depends:
- traces: assets.traces
- footprints: assets.footprints
- frame: downsample.frame
- overlaps: assets.overlaps
pix_frame:
type: cala.nodes.omf.pixel_stats.ingest_frame
depends:
- pixel_stats: assets.pix_stats
- frame: downsample.frame
- new_traces: trace_frame.latest_trace
- footprints: assets.footprints
comp_frame:
type: cala.nodes.omf.component_stats.ingest_frame
depends:
- component_stats: assets.comp_stats
- frame: downsample.frame
- new_traces: trace_frame.latest_trace
footprints_frame:
type: cala.nodes.omf.footprints.Footprinter
params:
bep: 0
tol: 0.0001
max_iter: 5
ratio_lb: 0.10
depends:
- footprints: assets.footprints
- pixel_stats: pix_frame.value
- component_stats: comp_frame.value

residual:
type: cala.nodes.omf.residual.Residuer
depends:
- frame: downsample.frame
- footprints: footprints_frame.footprints
- traces: assets.traces
- residuals: assets.residuals
# FRAME UPDATE ENDS

# DETECT BEGINS
nmf:
type: cala.nodes.segment.SliceNMF
params:
min_frames: 100
detect_thresh: 8.0
reprod_tol: 0.005
depends:
- residuals: residual.movie
- energy: residual.std
- detect_radius: size_est.radius
catalog:
type: cala.nodes.segment.Cataloger
params:
age_limit: 100
shape_smooth_kwargs:
ksize: [ 5, 5 ]
sigmaX: 0
trace_smooth_kwargs:
sigma: 2
merge_threshold: 0.9
val_threshold: 0.5
cnt_threshold: 5
depends:
- new_fps: nmf.new_fps
- new_trs: nmf.new_trs
- existing_fp: assets.footprints
- existing_tr: assets.traces
detect_update:
type: cala.nodes.segment.update_assets
depends:
- new_footprints: catalog.new_footprints
- new_traces: catalog.new_traces
- footprints: assets.footprints
- traces: assets.traces
- pixel_stats: assets.pix_stats
- component_stats: assets.comp_stats
- overlaps: assets.overlaps
- buffer: assets.buffer
# DETECT ENDS

save_trace:
type: cala.nodes.io.save_asset
params:
target_epoch: 855999 # formula: 1000 * n_chunks - 1
path: traces_fin/
depends:
- asset: assets.traces
- curr_epoch: counter.idx

save_shape:
type: cala.nodes.io.save_asset
params:
target_epoch: 855999 # formula: 1000 * n_chunks - 1
path: footprints_fin/
depends:
- asset: assets.footprints
- curr_epoch: counter.idx
8 changes: 8 additions & 0 deletions src/cala/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from pathlib import Path


def add_noob_sources() -> list[Path]:
"""
Expose packages tubes to noob via its ``noob.add_sources`` entrypoint.
"""
return [Path(__file__).parent / "data"]
Loading