Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BasicSSASolver not structuring output data correctly #50

Closed
technodivergent opened this issue Jan 28, 2019 · 5 comments
Closed

BasicSSASolver not structuring output data correctly #50

technodivergent opened this issue Jan 28, 2019 · 5 comments
Assignees

Comments

@technodivergent
Copy link
Contributor

Model:

class DayModel(gillespy2.Model):
    def __init__(self, parameter_values=None, init_v=0):
        # initialize
        gillespy2.Model.__init__(self, name="Macrophage")
        
        # species
        S_ = gillespy2.Species(name='S_', initial_value=4e3) # low = 4e3; mid = 2e4; high = 1e7
        
        A_ = gillespy2.Species(name='A_', initial_value=6e9) # A = Sa/(k2*S+MuA)
        
        H1 = gillespy2.Species(name='H1', initial_value=0)
        H2 = gillespy2.Species(name='H2', initial_value=0)
        H3 = gillespy2.Species(name='H3', initial_value=0)
        H4 = gillespy2.Species(name='H4', initial_value=0)
        H5 = gillespy2.Species(name='H5', initial_value=0)
        H6 = gillespy2.Species(name='H6', initial_value=0)
        
        HLN1 = gillespy2.Species(name='HLN1', initial_value=0)
        HLN2 = gillespy2.Species(name='HLN2', initial_value=0)
        HLN3 = gillespy2.Species(name='HLN3', initial_value=0)
        HLN4 = gillespy2.Species(name='HLN4', initial_value=0)
        HLN5 = gillespy2.Species(name='HLN5', initial_value=0)
        HLN6 = gillespy2.Species(name='HLN6', initial_value=0)
        
        self.add_species([S_,A_,H1,H2,H3,H4,H5,H6,HLN1,HLN2,HLN3,HLN4,HLN5,HLN6])
        
        # parameters
        # num(spores) per macrophage
        ns = gillespy2.Parameter(name='ns', expression=3) # avg = 3.38
        
        # rate of phagocytosis
        k2 = gillespy2.Parameter(name='k2', expression=1e-5)
        
        # migration to TMLN
        k3 = gillespy2.Parameter(name='k3', expression=1e3)

        # source of macrophages per hour
        Sa = gillespy2.Parameter(name='Sa', expression=3e8)
        
        # decay rate of macrophages
        MuA = gillespy2.Parameter(name='MuA', expression=0.05)
        
        self.add_parameter([ns,k2,k3,Sa,MuA])
        
        # reactions
        R1 = gillespy2.Reaction(
            name='R1',
            reactants={S_:1, A_:1},
            products={H1:1},
            rate=k2
        )
        
        R2 = gillespy2.Reaction(
            name='R2',
            reactants={S_:1, H1:1},
            products={H2:1},
            rate=k2
        )
        
        R3 = gillespy2.Reaction(
            name='R3',
            reactants={S_:1, H2:1},
            products={H3:1},
            rate=k2
        )
        
        R4 = gillespy2.Reaction(
            name='R4',
            reactants={S_:1, H3:1},
            products={H4:1},
            rate=k2
        )
        
        R5 = gillespy2.Reaction(
            name='R5',
            reactants={S_:1, H4:1},
            products={H5:1},
            rate=k2
        )
        
        R6 = gillespy2.Reaction(
            name='R6',
            reactants={S_:1, H5:1},
            products={H6:1},
            rate=k2
        )
        
        # To the lung
        R7 = gillespy2.Reaction(
            name='R7',
            reactants={H1:1},
            products={HLN1:1},
            rate=k3
        )
        
        R8 = gillespy2.Reaction(
            name='R8',
            reactants={H2:1},
            products={HLN2:1},
            rate=k3
        )
        
        R9 = gillespy2.Reaction(
            name='R9',
            reactants={H3:1},
            products={HLN3:1},
            rate=k3
        )
        
        R10 = gillespy2.Reaction(
            name='R10',
            reactants={H4:1},
            products={HLN4:1},
            rate=k3
        )
        
        R11 = gillespy2.Reaction(
            name='R11',
            reactants={H5:1},
            products={HLN5:1},
            rate=k3
        )
        
        R12 = gillespy2.Reaction(
            name='R12',
            reactants={H6:1},
            products={HLN6:1},
            rate=k3
        )
                
        self.add_reaction([R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12])
        t = numpy.linspace(0,40,801)
        self.timespan(t)
        #print(t)

When running this model through the BasicSSASolver, the results array is not always structured in a manner consistent with the other solvers while at other times it is.

For instance:
When using the value k3 <= 0.25, I can print/plot results[0]['time']
When using the value k3 >= 0.26, I must use results['time'] instead

@technodivergent
Copy link
Contributor Author

technodivergent commented Jan 29, 2019

Lung Submodel.zip
@seanebum

And on a different machine, the values aren't delineated between .25 and .26, but using 1e3 and 1e-3 seem to break it.

@briandrawert briandrawert added this to the 1.0 Release milestone Jan 30, 2019
@seanebum
Copy link
Contributor

seanebum commented Jan 31, 2019 via email

@seanebum
Copy link
Contributor

seanebum commented Jan 31, 2019 via email

@briandrawert
Copy link
Member

This is now: Fix show_labels in BasicSSASolver

@briandrawert
Copy link
Member

Made vestigial by #57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants