Auerbach-Lab / Behavior-autoanalysis

Rat behavioral assay data curation and validation
1 stars 0 forks source link

Supervisor Summarize performance #46

Open tofof opened 1 year ago

tofof commented 1 year ago

Very slow. Should do profiling and determine if there are poorly-optimized operations that can be sped up.

For example:

df_TH_tones = r %>% unnest(reaction) %>%
              dplyr::filter(task == "TH" & `Dur (ms)` == min_duration & `Freq (kHz)` != 0) %>% #select(-threshold, -file_name, - weight, -mean_attempts_per_trial) %>% View
              right_join(intensity, by = "date") %>%
              filter(`Inten (dB)` == desired_dB) %>%
              group_by(date) %>%
              mutate(Rxn = mean(Rxn)) %>%
              select(-desired_dB)

It's possible that moving the select to the top and joining the two filters would make this operation faster.

tofof commented 1 year ago

Can cut time in half by permanently unnest_wider several parts of run_archive. Further speed improvement needs to focus on difficult regular unnests, which consume 80%+ of runtime.