def test_rename(collection): dense_rt = collection.variables['RT'].to_dense(10) assert len(dense_rt.values) == 230400 transform.Rename(collection, 'RT', output='reaction_time') assert 'reaction_time' in collection.variables assert 'RT' not in collection.variables col = collection.variables['reaction_time'] assert col.name == 'reaction_time' assert col.onset.max() == 476
def test_rename(collection): dense_rt = collection.variables['RT'].to_dense(collection.sampling_rate) assert len(dense_rt.values) == math.ceil(len(SUBJECTS) * NRUNS * SCAN_LENGTH * collection.sampling_rate) transform.Rename(collection, 'RT', output='reaction_time') assert 'reaction_time' in collection.variables assert 'RT' not in collection.variables col = collection.variables['reaction_time'] assert col.name == 'reaction_time' assert col.onset.max() == 476
def test_group(collection): coll = collection.clone() with pytest.raises(ValueError): # Can't use an existing variable name as the group name transform.Group(coll, ['gain', 'loss'], name='gain') transform.Group(coll, ['gain', 'loss'], name='outcome_vars') assert coll.groups == {'outcome_vars': ['gain', 'loss']} # Checks that variable groups are replaced properly transform.Rename(coll, ['outcome_vars'], output=['gain_renamed', 'loss_renamed']) assert 'gain_renamed' in coll.variables assert 'loss_renamed' in coll.variables assert 'gain' not in coll.variables assert 'loss' not in coll.variables