Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

00_counterbalance.py 1.0 KB

123456789101112131415161718192021222324252627
  1. # generates counterbalance.csv, which contains the stim_grp and resp_grp for each subj_id
  2. # (combinations of resp_grp and stim_grp are distributed equally and randomly)
  3. import pandas as pd
  4. import numpy as np
  5. np.random.seed(0)
  6. n_subj = 68
  7. grps = pd.DataFrame(data={'subj_id': np.arange(0, n_subj)+1})
  8. combs = np.array([[1, 1], [1, 2], [2, 1], [2, 2]])
  9. comb_ns = np.repeat(np.floor(n_subj/len(combs)), len(combs))
  10. comb_ns += np.random.permutation([np.int(x) for x in '{0:04d}'.format(int(n_subj - np.sum(comb_ns)))])
  11. grps['grp_idx'] = np.random.permutation(np.concatenate([np.array([x]*int(n)) for x, n in enumerate(comb_ns)]))
  12. grps['stim_grp'] = [combs[i][0] for i in grps['grp_idx']]
  13. grps['resp_grp'] = [combs[i][1] for i in grps['grp_idx']]
  14. # this should be distributed as close to equally as possible
  15. # grps.grp_idx.value_counts()
  16. # add fake participant for testing
  17. grps = grps.append({'subj_id': '0_test', 'grp_idx':0, 'stim_grp':1, 'resp_grp':1}, ignore_index=True)
  18. grps.to_csv('counterbalance.csv', index=False)