Skip to content

Commit

Permalink
Merge branch 'workflows' into workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
guitchounts authored Aug 30, 2021
2 parents 0c094f0 + 56e44a5 commit ef6d332
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions moseq2_ephys_sync/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,29 @@ def main_function(base_path, output_dir_name, first_source, second_source, led_l
# Save the codes for use later
np.savez('%s/codes.npz' % save_path, first_source_codes=first_source_led_codes, second_source_codes=second_source_led_codes)


# Visualize a small chunk of the bit codes. do you see a match?
# Codes array should have times in seconds by this point
plotting.plot_code_chunk(first_source_led_codes, second_source_led_codes, save_path)

################################# Load the ephys TTL data #####################################

ephys_ttl_path = glob('%s/**/TTL_*/' % base_path,recursive = True)[0]
channels = np.load('%s/channel_states.npy' % ephys_ttl_path)
ephys_timestamps = np.load('%s/timestamps.npy' % ephys_ttl_path)

## need to subtract the raw traces' starting timestamp from the TTL timestamps:
continuous_timestamps_path = glob('%s/**/continuous/**/timestamps.npy' % base_path,recursive = True)[0] ## load the continuous stream's timestamps
continuous_timestamps = np.load(continuous_timestamps_path)

ephys_timestamps -= continuous_timestamps[0] ## subract the first timestamp from all TTLs; this way continuous ephys can safely start at 0 samples or seconds


ephys_fs = 3e4

led_fs = 30





Expand All @@ -105,6 +124,7 @@ def main_function(base_path, output_dir_name, first_source, second_source, led_l




#### Make the models! ####

# Rename for clarity.
Expand Down

0 comments on commit ef6d332

Please sign in to comment.