def test_4_epoch_times_list_epoch1Istimulus(self):
     #              <---100--->   <----50---->
     # 0----------10-----------110------------160------------200
     # ep0        ep1          ep2            ep3
     ic_stimparam = {
         "type": ["current", "IClamp"],
         "stimlist": [
             {
                 "amp": 0.5,
                 "dur": 100.0,
                 "delay": 10
             },  # 0, 10.0
             {
                 "amp": 1.0,
                 "dur": 50.0,
                 "delay": 10.0 + 100.0
             }
         ],
         "tstop":
         self.ic_runtimeparam["tstop"]
     }
     [start_ts, stop_ts] = eg.epoch_times_list(ic_stimparam)
     #print(start_ts, stop_ts)
     a = Counter(start_ts) == Counter([0, 10, 110, 160])
     b = Counter(stop_ts) == Counter([10, 110, 160, 200])
     self.assertEqual([a, b], [True, True])
 def test_7_epoch_times_list_nostimulus(self):
     # 0----------10
     # ep0
     [start_ts, stop_ts] = eg.epoch_times_list(self.no_runtimeparam)
     #print(start_ts, stop_ts)
     a = Counter(start_ts) == Counter([0])
     b = Counter(stop_ts) == Counter([self.no_runtimeparam["tstop"]])
     self.assertEqual([a, b], [True, True])
 def test_9_epochcontainer_for_regionbodies_currentstimulus(self):
     no_of_epochs = eg.compute_totalepochs_per_cellregion(
         self.ic_stimparameters)
     [start_ts, stop_ts] = eg.epoch_times_list(self.ic_stimparameters)
     filler = eg.epochcontainer_for_regionbodies(self.chosenmodel,
                                                 no_of_epochs, start_ts,
                                                 stop_ts)
     #print(filler) # how does the epochcontainer metadata look?
     # self.chosenmodel.regions ->
     # {"soma": ["v", "i_cap"], "axon": ["v"],
     # "channels": {"soma": {"hh": ["il", "el"], "pas": ["i"]}, "axon": {"pas": ["i"]}}}
     compare1a = filler["epoch0soma"]["v"]["tags"][0]  # number of epochs
     compare1b = filler["epoch0soma"]["v"]["tags"][1]  # epochID
     compare1c = filler["epoch0soma"]["v"]["tags"][2].split()[-1]  # recsite
     compare1d = filler["epoch0soma"]["v"]["tags"][3]  # all recsites
     compare1e = filler["epoch0soma"]["v"]["tags"][4]  # modelname
     compare1f = filler["epoch0soma"]["v"]["tags"][5]  # modelscale
     compare1g = filler["epoch0soma"]["v"]["tags"][6].split()[
         -1]  # key for recsite
     compare2a = filler["epoch0axon"]["v"]["tags"][0]
     compare2b = filler["epoch0axon"]["v"]["tags"][1]
     compare2c = filler["epoch0axon"]["v"]["tags"][2].split()[-1]
     compare2d = filler["epoch1soma"]["v"]["tags"][3]  # all recsites
     compare2e = filler["epoch0axon"]["v"]["tags"][4]
     compare2f = filler["epoch0axon"]["v"]["tags"][5]
     compare2g = filler["epoch1soma"]["v"]["tags"][6].split()[-1]
     #
     compare1 = [
         compare1a, compare1b, compare1c, compare1d, compare1e, compare1f,
         compare1g
     ]
     compare2 = [
         compare2a, compare2b, compare2c, compare2d, compare2e, compare2f,
         compare2g
     ]
     a = Counter(compare1) == Counter(compare2)
     #
     compare3a = filler["epoch0soma"]["v"]["tags"][1]  # epochID
     compare3b = filler["epoch0soma"]["v"]["tags"][2].split()[
         -1]  # [ region, recsite ]
     compare3c = filler["epoch0soma"]["v"]["tags"][3]  # all recsites
     compare4a = filler["epoch1soma"]["v"]["tags"][1]
     compare4b = filler["epoch1soma"]["i_cap"]["tags"][2].split()[-1]
     compare4c = filler["epoch0axon"]["v"]["tags"][3]
     #
     compare3 = [compare3a, compare3b, compare3c]
     compare4 = [compare4a, compare4b, compare4c]
     b = Counter(compare3) != Counter(compare4)
     #
     self.assertEqual([a, b], [True, True])
 def test_8_epochcontainer_for_regionbodies_nostimulus(self):
     no_of_epochs = eg.compute_totalepochs_per_cellregion(
         self.no_runtimeparam)
     [start_ts, stop_ts] = eg.epoch_times_list(self.no_runtimeparam)
     filler = eg.epochcontainer_for_regionbodies(self.chosenmodel,
                                                 no_of_epochs, start_ts,
                                                 stop_ts)
     compare2 = len(filler)
     # self.chosenmodel.regions ->
     # {"soma": ["v", "i_cap"], "axon": ["v"],
     # "channels": {"soma": {"hh": ["il", "el"], "pas": ["i"]}, "axon": {"pas": ["i"]}}}
     no_of_regions = 2
     compare1 = no_of_regions * no_of_epochs
     a = Counter( [ compare2, filler["epoch0soma"]["v"]["start_time"],
                    filler["epoch0soma"]["v"]["stop_time"] ] ) \
         == Counter( [ compare1, filler["epoch0axon"]["v"]["start_time"],
                       self.no_runtimeparam["tstop"] ] )
     #print filler # how does the epochcontainer metadata look?
     self.assertEqual(a, True)
 def test_6_epoch_times_list_Vstimulus(self):
     #  <---10--->  <----20---->
     # 0----------10-----------20------------35
     # ep0        ep1          ep2
     sec_stimparam = {
         "type": ["voltage", "SEClamp"],
         "stimlist": [{
             'amp1': 0.,
             'dur1': 10.0
         }, {
             'amp2': -70.0,
             'dur2': 20.0
         }],
         "tstop": self.sec_runtimeparam["tstop"]
     }
     [start_ts, stop_ts] = eg.epoch_times_list(sec_stimparam)
     #print(start_ts, stop_ts)
     a = Counter(start_ts) == Counter([0, 10, 20])
     b = Counter(stop_ts) == Counter([10, 20, 35])
     self.assertEqual([a, b], [True, True])