Skip to content

Commit

Permalink
Merge pull request #388 from ttngu207/datajoint_pipeline
Browse files Browse the repository at this point in the history
Add devices_schema for social0.4 and other minor code cleanup
  • Loading branch information
ttngu207 authored Aug 15, 2024
2 parents 054db5c + fa3d857 commit 16578fa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
5 changes: 5 additions & 0 deletions aeon/dj_pipeline/analysis/block_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ def make(self, key):
continue
next_threshold_time = pellet_ts_threshold_df.index[threshold_idx + 1]
post_thresh_pellet_ts = beam_break_df.index[beam_break_df.index > next_threshold_time]
if post_thresh_pellet_ts.empty:
break
next_beam_break = post_thresh_pellet_ts[np.searchsorted(post_thresh_pellet_ts, next_threshold_time)]
pellet_ts_threshold_df.pellet_timestamp.iloc[threshold_idx] = next_beam_break
# remove NaNs from pellet_timestamp column (last row)
Expand Down Expand Up @@ -241,6 +243,9 @@ def make(self, key):

encoder_df["distance_travelled"] = -1 * analysis_utils.distancetravelled(encoder_df.angle)

if depletion_state_df.empty:
raise ValueError(f"No depletion state data found for block {key} - patch: {patch_name}")

if len(depletion_state_df.rate.unique()) > 1:
# multiple patch rates per block is unexpected, log a note and pick the first rate to move forward
AnalysisNote.insert1(
Expand Down
5 changes: 3 additions & 2 deletions aeon/dj_pipeline/populate/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,16 @@ def ingest_environment_visits():
"analysis_worker",
worker_schema_name=worker_schema_name,
db_prefix=db_prefix,
max_idled_cycle=6,
sleep_duration=1200,
max_idled_cycle=20,
sleep_duration=60,
)

analysis_worker(block_analysis.BlockAnalysis, max_calls=6)
analysis_worker(block_analysis.BlockPlots, max_calls=6)
analysis_worker(block_analysis.BlockSubjectAnalysis, max_calls=6)
analysis_worker(block_analysis.BlockSubjectPlots, max_calls=6)


def get_workflow_operation_overview():
from datajoint_utilities.dj_worker.utils import get_workflow_operation_overview
return get_workflow_operation_overview(worker_schema_name=worker_schema_name, db_prefixes=[db_prefix])
33 changes: 32 additions & 1 deletion aeon/schema/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,35 @@
)


__all__ = ["exp01", "exp02", "octagon01", "social01", "social02", "social03"]
social04 = DotMap(
[
Device("Metadata", stream.Metadata),
Device("Environment", social_02.Environment, social_02.SubjectData),
Device("CameraTop", stream.Video, social_03.Pose),
Device("CameraNorth", stream.Video),
Device("CameraSouth", stream.Video),
Device("CameraEast", stream.Video),
Device("CameraWest", stream.Video),
Device("CameraNest", stream.Video),
Device("CameraPatch1", stream.Video),
Device("CameraPatch2", stream.Video),
Device("CameraPatch3", stream.Video),
Device("Nest", social_02.WeightRaw, social_02.WeightFiltered),
Device("Patch1", social_02.Patch),
Device("Patch2", social_02.Patch),
Device("Patch3", social_02.Patch),
Device("PatchDummy1", social_02.Patch),
Device("NestRfid1", social_02.RfidEvents),
Device("NestRfid2", social_02.RfidEvents),
Device("GateRfid", social_02.RfidEvents),
Device("GateEastRfid", social_02.RfidEvents),
Device("GateWestRfid", social_02.RfidEvents),
Device("Patch1Rfid", social_02.RfidEvents),
Device("Patch2Rfid", social_02.RfidEvents),
Device("Patch3Rfid", social_02.RfidEvents),
Device("PatchDummy1Rfid", social_02.RfidEvents),
]
)


__all__ = ["exp01", "exp02", "octagon01", "social01", "social02", "social03", "social04"]

0 comments on commit 16578fa

Please # to comment.