Open nohelix opened 5 months ago
Get_File_Summary_BBN_Tone
should be fineOriginal Output:
Browse[2]> file_frequency_ranges %>%
+ dplyr::group_by(`Freq (kHz)`, `Delay (s)`, `Type`) %>%
+ dplyr::summarise(dB_min = min(dB),
+ dB_max = max(dB),
+ dB_step_size = dB - lag(dB, default = first(dB)),
+ duration = list(run_properties$duration),
+ .groups = 'keep')
Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in dplyr 1.1.0.
ℹ Please use `reframe()` instead.
ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()` always returns an ungrouped data frame and adjust accordingly.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
# A tibble: 7 × 7
# Groups: Freq (kHz), Delay (s), Type [1]
`Freq (kHz)` `Delay (s)` Type dB_min dB_max dB_step_size duration
<dbl> <chr> <dbl> <dbl> <dbl> <dbl> <list>
1 0 1 4 1 15 75 0 <df [1 × 1]>
2 0 1 4 1 15 75 10 <df [1 × 1]>
3 0 1 4 1 15 75 10 <df [1 × 1]>
4 0 1 4 1 15 75 10 <df [1 × 1]>
5 0 1 4 1 15 75 10 <df [1 × 1]>
6 0 1 4 1 15 75 10 <df [1 × 1]>
7 0 1 4 1 15 75 10 <df [1 × 1]>
Bad code output:
Browse[2]> file_frequency_ranges %>%
+ dplyr::group_by(`Freq (kHz)`, `Delay (s)`, `Type`) %>%
+ dplyr::summarise(dB_min = min(dB),
+ dB_max = max(dB),
+ dB_step_size = dB - lag(dB, default = first(dB)),
+ temp = unique(Type),
+ duration = list(filter(run_properties$stim_encoding_table, Type == temp)$`Dur (ms)` %>% unique %>% as.data.frame()),
+ .groups = 'keep') %>%
+ select(-temp)
Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in dplyr 1.1.0.
ℹ Please use `reframe()` instead.
ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()` always returns an ungrouped data frame and adjust accordingly.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
# A tibble: 7 × 7
# Groups: Freq (kHz), Delay (s), Type [1]
`Freq (kHz)` `Delay (s)` Type dB_min dB_max dB_step_size duration
<dbl> <chr> <dbl> <dbl> <dbl> <dbl> <list>
1 0 1 4 1 15 75 0 <df [1 × 1]>
2 0 1 4 1 15 75 10 <df [1 × 1]>
3 0 1 4 1 15 75 10 <df [1 × 1]>
4 0 1 4 1 15 75 10 <df [1 × 1]>
5 0 1 4 1 15 75 10 <df [1 × 1]>
6 0 1 4 1 15 75 10 <df [1 × 1]>
7 0 1 4 1 15 75 10 <df [1 × 1]>
graphing_unrolled.R
is due to 187: Generate_Graph [Z:/Behavior-autoanalysis/graphing unrolled.R#220]
which references file_name.
https://github.com/Auerbach-Lab/Behavior-autoanalysis/blob/3c22df14928e1e40f6743515b8b29b5f1d5a763d/graphing%20unrolled.R#L220Original File name: BBN_15-75dB_100ms_4s frequency range fix File name: BBN_15-75dB_100ms_4s
Same name and appears to work in testing environment.
Fails in live environment
File name: BBN_80dB_0-2000ms_12s_BG_PKN_0dB 101 failed in live enviornment.zip
Warning: Error in filter: ℹ In argument: `str_detect(file_name, pattern = glue("_{current_durations}ms_"))`.
Caused by error in `str_detect()`:
! Can't recycle `string` (size 13) to match `pattern` (size 0).
208: <Anonymous>
207: signalCondition
206: signal_abort
205: abort
204: <Anonymous>
203: signalCondition
202: signal_abort
201: abort
200: stop_vctrs
199: stop_incompatible
198: stop_incompatible_size
197: vctrs::vec_size_common
196: check_lengths
195: str_detect
194: eval
193: mask$eval_all_filter
191: filter_eval
190: filter_rows
189: filter.data.frame
187: Generate_Graph [Z:/Behavior-autoanalysis/graphing unrolled.R#220]
186: Generate_Extra_Graphs [Z:/Behavior-autoanalysis/main.R#2034]
185: <reactive:extra_graphs> [Z:\Behavior-autoanalysis/app.R#407]
183: .func
180: contextFunc
179: env$runWith
172: ctx$run
171: self$.updateValue
169: extra_graphs
168: renderPlot [Z:\Behavior-autoanalysis/app.R#411]
166: func
126: drawPlot
112: <reactive:plotObj>
96: drawReactive
83: renderFunc
82: output$plotRxn
1: runApp
Input to asJSON(keep_vec_names=TRUE) is a named vector. In a future version of jsonlite, this option will not be supported, and named vectors will be translated into arrays instead of objects. If you want JSON object output, please use a named list instead. See ?toJSON.
Output non working:
Calculated run statistics.
Warning in Build_Filename() :
Caution: mismatch in provided filename: edge_BBN_80dB_1-2000ms_12s_BG_PKN_0dB
calculated filename by contents: BBN_80dB_0-2000ms_12s_BG_PKN_0dB
File name: BBN_80dB_0-2000ms_12s_BG_PKN_0dB
Warning in Check_Assigned_Filename() :
ACTION REQUIRED: Was rat run on the wrong file?
ERROR: Filename -- BBN_80dB_0-2000ms_12s_BG_PKN_0dB -- does not match
Assignment -- edge_BBN_80dB_1-2000ms_12s_BG_PKN_40dB
Filename checks complete.
Output working:
Calculated run statistics.
Warning in Build_Filename() :
Caution: mismatch in provided filename: edge_BBN_80dB_1-2000ms_12s_BG_PKN_0dB
calculated filename by contents: BBN_80dB_0-2000ms_12s_BG_PKN_0dB
File name: BBN_80dB_0-2000ms_12s_BG_PKN_0dB
Warning in Check_Assigned_Filename() :
ACTION REQUIRED: Was rat run on the wrong file?
ERROR: Filename -- BBN_80dB_0-2000ms_12s_BG_PKN_0dB -- does not match
Assignment -- edge_BBN_80dB_1-2000ms_12s_BG_PKN_40dB
Filename checks complete.
Only code difference:
dB_step_size = dB - lag(dB, default = first(dB)),
duration = list(run_properties$duration),
.groups = 'keep')
vs.
dB_step_size = dB - lag(dB, default = first(dB)),
`temp = unique(Type),
duration = list(filter(run_properties$stim_encoding_table, Type == temp)$`Dur (ms)` %>% unique %>% as.data.frame()),
.groups = 'keep') %>%
select(-temp)
See above comment where the outputs and names are identical.
❗ Related to #100
Issue
All durations listed regardless of type, i.e. for type 0 trials even type 1 trial durations are listed.
Repeatability
Import file in #100 or Red1_edge_BBN_60dB_1-2000ms_12s_BG_PKN_0dB_20240325-101031_BOX#007.zip Halt during naming look at
run_properties$stim_encoding_table
and atrun_properties$summary
You should get:
run_properties$stim_encoding_table
run_properties$summary
⬆️
duration
should be <df [1 × 1]> for type 0 and <df [7 × 1]> for type 1