aegis_sim.recording.envdriftmaprecorder
1import pathlib 2import numpy as np 3 4from .recorder import Recorder 5from aegis_sim import submodels 6 7 8class Envdriftmaprecorder(Recorder): 9 """ 10 11 Records once. 12 """ 13 14 def __init__(self, odir: pathlib.Path): 15 self.odir = odir 16 self.init_odir() 17 18 def write(self, step): 19 """ 20 21 # OUTPUT SPECIFICATION 22 path: /envdriftmap.csv 23 filetype: csv 24 category: genotype 25 description: XOR map for genome (0 = original phenotypic effect, 1 = opposite phenotypic effect). Recorded every ENVDRIFT_RATE steps. 26 trait granularity: N/A 27 time granularity: N/A 28 frequency parameter: ENVDRIFT_RATE 29 header: None 30 structure: row: record, column: genome position, value: 0 or 1 31 """ 32 envdrift = submodels.architect.envdrift 33 34 will_evolve = envdrift.will_evolve(step) 35 36 if will_evolve: 37 map_ = envdrift.map.flatten() 38 with open(self.odir / "envdriftmap.csv", "ab") as f: 39 array = np.array(map_) 40 np.savetxt(f, [array], delimiter=",", fmt="%i")
9class Envdriftmaprecorder(Recorder): 10 """ 11 12 Records once. 13 """ 14 15 def __init__(self, odir: pathlib.Path): 16 self.odir = odir 17 self.init_odir() 18 19 def write(self, step): 20 """ 21 22 # OUTPUT SPECIFICATION 23 path: /envdriftmap.csv 24 filetype: csv 25 category: genotype 26 description: XOR map for genome (0 = original phenotypic effect, 1 = opposite phenotypic effect). Recorded every ENVDRIFT_RATE steps. 27 trait granularity: N/A 28 time granularity: N/A 29 frequency parameter: ENVDRIFT_RATE 30 header: None 31 structure: row: record, column: genome position, value: 0 or 1 32 """ 33 envdrift = submodels.architect.envdrift 34 35 will_evolve = envdrift.will_evolve(step) 36 37 if will_evolve: 38 map_ = envdrift.map.flatten() 39 with open(self.odir / "envdriftmap.csv", "ab") as f: 40 array = np.array(map_) 41 np.savetxt(f, [array], delimiter=",", fmt="%i")
Records once.
def
write(self, step):
19 def write(self, step): 20 """ 21 22 # OUTPUT SPECIFICATION 23 path: /envdriftmap.csv 24 filetype: csv 25 category: genotype 26 description: XOR map for genome (0 = original phenotypic effect, 1 = opposite phenotypic effect). Recorded every ENVDRIFT_RATE steps. 27 trait granularity: N/A 28 time granularity: N/A 29 frequency parameter: ENVDRIFT_RATE 30 header: None 31 structure: row: record, column: genome position, value: 0 or 1 32 """ 33 envdrift = submodels.architect.envdrift 34 35 will_evolve = envdrift.will_evolve(step) 36 37 if will_evolve: 38 map_ = envdrift.map.flatten() 39 with open(self.odir / "envdriftmap.csv", "ab") as f: 40 array = np.array(map_) 41 np.savetxt(f, [array], delimiter=",", fmt="%i")
OUTPUT SPECIFICATION
path: /envdriftmap.csv filetype: csv category: genotype description: XOR map for genome (0 = original phenotypic effect, 1 = opposite phenotypic effect). Recorded every ENVDRIFT_RATE steps. trait granularity: N/A time granularity: N/A frequency parameter: ENVDRIFT_RATE header: None structure: row: record, column: genome position, value: 0 or 1