pyhrf.paradigm module¶
-
class
pyhrf.paradigm.Paradigm(stimOnsets, sessionDurations=None, stimDurations=None)¶ -
delete_condition(cond)¶
-
classmethod
from_csv(csvFile, delim=None)¶ Create a Paradigm object from a CSV file which columns are: session, task name, stimulation onset, stimulation duration, [amplitude]
-
classmethod
from_session_dict(d, sessionDurations=None)¶
-
classmethod
from_spm_mat(spm_mat_file)¶ TODO: handle session durations
-
get_info(long=True)¶
-
get_joined_and_rastered(dt)¶
-
get_joined_durations()¶ For each condition, join stimulus durations of all sessions.
-
get_joined_durations_dim()¶ For each condition, join stimulus durations of all sessions.
-
get_joined_onsets()¶ For each condition, join onsets of all sessions.
-
get_joined_onsets_dim()¶ For each condition, join onsets of all sessions.
-
get_nb_trials()¶
-
get_rastered(dt, tMax=None)¶ Return binary sequences of stimulus arrivals. Each stimulus event is approximated to the closest time point on the time grid defined by dt. eg return: { ‘cond1’ : [np.array([ 0 0 0 1 0 0 1 1 1 0 1]),
np.array([ 0 1 1 1 0 0 1 0 1 0 0])] },- ‘cond2’ : [np.array([ 0 0 0 1 0 0 1 1 1 0 0]),
- np.array([ 1 1 0 1 0 1 0 0 0 0 0])] },
- Arg:
dt (float): temporal resolution of the target grid
- tMax (float): total duration of the paradigm
If None, then use the session lengths
-
get_stimulus_names()¶
-
get_t_max()¶
-
join_sessions()¶
-
save_csv(csvFile)¶
-
save_spm_mat_for_1st_level_glm(mat_file, session=0)¶
-
to_nipy_paradigm()¶
-
-
pyhrf.paradigm.check_stim_durations(stim_onsets, stimDurations)¶ If no durations specified (stimDurations is None or empty np.array) then assume spiked stimuli: return a sequence of zeros with same shape as onsets sequence. Check that durations have same shape as onsets.
-
pyhrf.paradigm.contrasts_to_spm_vec(condition_list, contrasts)¶
-
pyhrf.paradigm.extend_sampled_events(sampled_events, sampled_durations)¶ Add events to encode stimulus duration
-
pyhrf.paradigm.merge_onsets(onsets, new_condition, criterion=None, durations=None, discard=None)¶ Convention for definition of onsets or durations: OrderedDict({
- ‘condition_name’: [<array of timings for sess1>,
- <array of timings for sess2>, ...]
}
-
pyhrf.paradigm.restarize_events(events, durations, dt, t_max)¶ build a binary sequence of events. Each event start is approximated to the nearest time point on the time grid defined by dt and t_max.