int snc_size = .layers.SNc.units.size;
float k = 1.0*.processes.Train_Prob.init_procs[0].s_args[0]/.layers.SNc.n_units;
// k is percentage of intact SNC units

UnitSpec* us = .specs.FixedBiasUnitSpec.LearnBiasUnitSpec.matrisom_unitspec;


int max_monval = .processes.Cycle_Prob.final_stats.size;
// number of monitor value statistics

int j;
for (j=0;j<max_monval;j++) .processes.Cycle_Prob.final_stats[j].mod.flag=0;
// don't monitor activities in plus phase (only care about activities during resp selection, in minus phase)


if ((k>0)&&(owner[0].se.val<0.5)) {
  int i; 
  for (i=0;i<snc_size;i++) {
//DA on Rew
   owner.owner.cur_event.patterns[2].value[i]=0.035; 
   .layers.SNc.units[i].ext=.035; 
// .035 ext translates to approx 0.7 activation 
//  70% smaller burst in PD compared with intact nets (also less intact DA units)

}
  us.act.gain=k*10000; // bigger gain (for D1 contrast effect)
 
}

else {

int i;
 for (i=0;i<snc_size;i++) {
   owner.owner.cur_event.patterns[2].value[i]=0; //No DA = DA dip
   .layers.SNc.units[i].ext=0;
 }

 us.act.gain=600-k*300; // smaller gain (contrast)
 us.act.thr=0.25;

}	

.processes.Settle_Prob.cycle.max=30; // burst/dip shouldn't last that long in plus phase!

float act0 = .layers."Motor Cortex".units[0].act_m;
float act1 = .layers."Motor Cortex".units[1].act_m;

// check to see which motor resp was most active in minus phase and clamp on in plus phase

if (act0 > act1) {
  owner.owner.cur_event.patterns[3].value[0] = 1.0;
  owner.owner.cur_event.patterns[3].value[1] = 0;
  owner.owner.cur_event.patterns[3].value[2] = 1.0;
  owner.owner.cur_event.patterns[3].value[3] = 0;
}

if (act1 > act0) {
  owner.owner.cur_event.patterns[3].value[0] = 0;
  owner.owner.cur_event.patterns[3].value[1] = 1.0;
  owner.owner.cur_event.patterns[3].value[2] = 0;
  owner.owner.cur_event.patterns[3].value[3] = 1.0;
}




GetMyTrialProc().SetCurLrate();