def testWriteToFileMultiple(self): csv = ParamCSVFile('testWrite2.csv') csvDict1 = {'a': 2, 'b': 3, 'c': 4} csv.writeToFile(csvDict1) csvDict2 = {'a': 5, 'b': 6, 'c': 7} valDict = csv.readFromFile() self.assertEqual(valDict, {'a': [2, 5], 'b': [3, 6], 'c': [4, 7]})
def testInit(self): csv = ParamCSVFile('test.csv') self.assertEqual(csv.filename, 'test.csv') self.assertEqual(csv.newline, '')
def testGetParamAverages(self): csv = ParamCSVFile('testParam.csv') avgs = csv.getParamAverages() self.assertEqual(avgs, [2, 2, 2])
def testWriteToFile(self): csv = ParamCSVFile('testWrite1.csv') csvDict = {'a': 2, 'b': 3, 'c': 4} csv.writeToFile(csvDict) valDict = csv.readFromFile() self.assertEqual(valDict, {'a': [2], 'b': [3], 'c': [4]})
def testReadFromFileGrouped(self): csv = ParamCSVFile('test.csv') vals = csv.readFromFile() self.assertEqual(names, ['a', 'b']) self.assertEqual(vals, [1, 2])
def testReadFromFile(self): csv = ParamCSVFile('test.csv') vals = csv.readFromFile() self.assertEqual(vals, [1, 2])
] IC_conc_var_steady_state = [ 5.0, 0.0, 4.0, 5.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0 ] group = 'Roff' noise = True refractory_activation = True div = 10 # create file for MC object (instantiation changes whether or not file is already in directory) filename = 'paramSetsMC.csv' paramSetsMC = None for _, _, files in os.walk('.', topdown=False): if filename in files: paramSetsMC = ParamCSVFile(filename, False) else: paramSetsMC = ParamCSVFile(filename, True) # create file for W object filename = 'paramSetsW.csv' paramSetsW = None for _, _, files in os.walk('.', topdown=False): if filename in files: paramSetsW = ParamCSVFile(filename, False) else: paramSetsW = ParamCSVFile(filename, True) # create file for Dunmyre object filename = 'paramSetsD.csv' paramSetsD = None