Skip to content

Commit

Permalink
initial fixes to fernald marchman
Browse files Browse the repository at this point in the history
  • Loading branch information
mzettersten committed Aug 30, 2024
1 parent 102f904 commit 6381779
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
11 changes: 8 additions & 3 deletions data/fernald_marchman_2012/ReadME.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ Note: for images, some images were shown in slightly different versions or mirro

For the manju and tempo trials, some were exposure where the object was on a background and some were tests where they were not on the background.

5. Importing ambiguity
Some images were mirrored depending on left/right positioning - image labels L and R are from the participants' perspective.

IMPORTANT: for related/unrelated prime noun/verb trials, the trials are represented in the raw data TWICE - once centered on the onset of the verb and once centered on the onset of the noun. We only keep the trial representation centered on the onset of the noun.

5. Importing ambiguity

ToDos:
* check with Martin and/or Virginia about whether slightly different images (mirroring) matter
Point of disambiguation is tricky for verb and adjective trials - should this be the first informative moment (e.g. when an informative verb was mentioned) or at the onset of the noun?

In the raw data, point of disambiguation:
- exposure novel trials: F0 is the onset of the verb
- 24mos: adjective: word onset is the adjective
- 30mos: hard adjective trials: onset of the color/ size
39 changes: 22 additions & 17 deletions data/fernald_marchman_2012/import.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ d_processed_24 <- d_raw_24 %>%
d_raw_30 <- read_delim(fs::path(read_path, "TL230ABoriginalichartsn1-121toMF.txt"),
delim = "\t"
)
# remove duplicated trials (recentered on verb instead of noun)
d_raw_30 <- d_raw_30 |>
filter(
!(OriginalCondition %in% c("R-primeVerb","UR-primeVerb"))
)

# d_raw_30 has two slightly different types of rows mixed together
d_processed_30_part_1 <- d_raw_30 |>
filter(is.na(Shifts)) |>
Expand All @@ -60,15 +66,17 @@ d_processed_30_part_1 <- d_raw_30 |>

d_processed_30_part_2 <- d_raw_30 |>
filter(!is.na(Shifts)) |>
# these *do* have looking data in non-looking cols
rename(
f01 = `Frames - word starts at frame 45 `,
f02 = `First Shift Gap`,
f03 = `RT`,
f04 = `CritOnSet`,
f05 = `CritOffSet`
) |>
# # these *do* have looking data in non-looking cols
# rename(
# f01 = `Frames - word starts at frame 45 `,
# f02 = `First Shift Gap`,
# f03 = `RT`,
# f04 = `CritOnSet`,
# f05 = `CritOffSet`
# ) |>
preprocess_raw_data() %>%
#drop final x column
select(-x270) %>%
relabel_time_cols(
metadata_names = extract_col_types(.)[["metadata_names"]],
pre_dis_names = extract_col_types(.)[["pre_dis_names"]],
Expand Down Expand Up @@ -143,9 +151,6 @@ d_tidy <- d_tidy %>%
TRUE ~ right_image
))


## TODO See Readme for some questions about stimulus table

# create stimulus table
stimulus_table_link <- d_tidy %>%
distinct(target_image, target_label) |>
Expand Down Expand Up @@ -230,7 +235,7 @@ d_tidy <- d_tidy %>%
)

# create zero-indexed ids for trial_types
d_trial_type_ids <- d_tidy %>%
d_trial_type_ids <- d_tidy %>%
distinct(
target_id, distractor_id, target_side,
condition
Expand All @@ -252,7 +257,7 @@ d_tidy_semifinal <- d_tidy %>%
left_join(d_administration_ids) %>%
left_join(d_trial_type_ids) |>
select(-condition2, -original_condition, -cond_orig)


# get zero-indexed trial ids for the trials table
d_trial_ids <- d_tidy_semifinal %>%
Expand All @@ -262,13 +267,13 @@ d_trial_ids <- d_tidy_semifinal %>%
) %>%
# the prescreen notes are not attached to all rows of a trial (sub_num x session x months x trial_type_id), so we fix this
group_by(sub_num, session, months, trial_type_id) %>%
summarize(prescreen_notes = first(na.omit(prescreen_notes)), .groups = 'drop') %>%
summarize(prescreen_notes = first(na.omit(prescreen_notes)), .groups = 'drop') %>%
mutate(excluded = !is.na(prescreen_notes)) |>
rename(exclusion_reason = prescreen_notes) |>
group_by(sub_num, session, months) %>%
mutate(trial_order = cumsum(trial_type_id != lag(trial_type_id, default = first(trial_type_id)))) %>%
ungroup() %>%
mutate(trial_id = 0:(n()-1)) %>%
ungroup() %>%
mutate(trial_id = 0:(n()-1)) %>%
distinct()

# join
Expand Down Expand Up @@ -464,5 +469,5 @@ write_and_validate(
aoi_region_sets = NA,
xy_timepoints = NA,
aoi_timepoints,
upload = TRUE
upload = FALSE
)
6 changes: 0 additions & 6 deletions data/fernald_marchman_2012/notes

This file was deleted.

0 comments on commit 6381779

Please sign in to comment.