Example #1
0
    def render(self,model):
        for i in range(0,model.size()):
            p = sim_helpers.safelog(redking.rk_real_getitem(model.get_parasites(),i))
            h = sim_helpers.safelog(redking.rk_real_getitem(model.get_hosts(),i))
            c = self.pixels[(model.size()-i)-1,int(self.pos)]

            # squash the log10
            p=min(1,abs(p))
            h=min(1,abs(h))

            # screen blend mode
            col = [(1-self.parasite_col[0]*p)*(1-self.host_col[0]*h),
                   (1-self.parasite_col[1]*p)*(1-self.host_col[1]*h),
                   (1-self.parasite_col[2]*p)*(1-self.host_col[2]*h)]

            # convert to 8 bit
            c[0] = (1-col[0])*255
            c[1] = (1-col[1])*255
            c[2] = (1-col[2])*255

            if c[0]>255: c[0]=255
            if c[1]>255: c[1]=255
            if c[2]>255: c[2]=255

            self.pixels[(model.size()-i)-1,int(self.pos)]=c
        self.pos+=self.x_per_render
Example #2
0
def combined_array(model):
    #return [safelog(redking.rk_real_getitem(m.get_hosts(),i) +
    #                redking.rk_real_getitem(m.get_parasites(),i))
    #        for i in range(0,model.size())]
    return [redking.rk_real_getitem(model.get_hosts(),i) +
            redking.rk_real_getitem(model.get_parasites(),i)
            for i in range(0,model.size())]
Example #3
0
    def render(self, model):
        for i in range(0, model.size()):
            p = sim_helpers.safelog(
                redking.rk_real_getitem(model.get_parasites(), i))
            h = sim_helpers.safelog(
                redking.rk_real_getitem(model.get_hosts(), i))
            c = self.pixels[(model.size() - i) - 1, int(self.pos)]

            # squash the log10
            p = min(1, abs(p))
            h = min(1, abs(h))

            # screen blend mode
            col = [(1 - self.parasite_col[0] * p) * (1 - self.host_col[0] * h),
                   (1 - self.parasite_col[1] * p) * (1 - self.host_col[1] * h),
                   (1 - self.parasite_col[2] * p) * (1 - self.host_col[2] * h)]

            # convert to 8 bit
            c[0] = (1 - col[0]) * 255
            c[1] = (1 - col[1]) * 255
            c[2] = (1 - col[2]) * 255

            if c[0] > 255: c[0] = 255
            if c[1] > 255: c[1] = 255
            if c[2] > 255: c[2] = 255

            self.pixels[(model.size() - i) - 1, int(self.pos)] = c
        self.pos += self.x_per_render
Example #4
0
def combined_array(model):
    #return [safelog(redking.rk_real_getitem(m.get_hosts(),i) +
    #                redking.rk_real_getitem(m.get_parasites(),i))
    #        for i in range(0,model.size())]
    return [redking.rk_real_getitem(model.get_hosts(),i) +
            redking.rk_real_getitem(model.get_parasites(),i)
            for i in range(0,model.size())]
Example #5
0
def parasite_matrix(model):
    ret = []
    for i in range(0, model.size()):
        m = model.get_matrix_row(i)
        ret+=[redking.rk_real_getitem(m,j)
              for j in range(model.size())]
    return ret
Example #6
0
def parasite_matrix(model):
    ret = []
    for i in range(0, model.size()):
        m = model.get_matrix_row(i)
        ret+=[redking.rk_real_getitem(m,j)
              for j in range(model.size())]
    return ret
Example #7
0
def host_cost(model):
    return [
        redking.rk_real_getitem(model.get_host_cost(), i)
        for i in range(0, model.size())
    ]
Example #8
0
def host_state_array(model):
    return [
        redking.rk_real_getitem(model.get_hosts(), i)
        for i in range(0, model.size())
    ]
Example #9
0
def parasite_state_array(model):
    return [
        redking.rk_real_getitem(model.get_parasites(), i)
        for i in range(0, model.size())
    ]
Example #10
0
def host_cost(model):
    return [redking.rk_real_getitem(model.get_host_cost(),i)
            for i in range(0,model.size())]
Example #11
0
def host_state_array(model):
    return [redking.rk_real_getitem(model.get_hosts(),i)
            for i in range(0,model.size())]
Example #12
0
def parasite_state_array(model):
    return [redking.rk_real_getitem(model.get_parasites(),i)
            for i in range(0,model.size())]