<commit_before>from sympy import Matrix,Symbol,diff,latex
#from create_cfile_LNA import create_c
import os
import sys
model_ = sys.argv[1]
LNAout = sys.argv[2]
os.system('python formatmodel.py '+model_)

from model import model

[S,a,nreactions,nvariables,ymat,Mumat,c] = model()


def LNA(S,a,ymat,c,LNAout):

    dPdt = Matrix(len(ymat),1,lambda i,j:0)
    for i in range(len(ymat)):
        dPidt = S[i,0]*a[0]
        for j in range(1,len(a)):
            dPidt += S[i,j]*a[j]
        dPdt[i] = dPidt  #Matrix of the deterministic parts of each species differentiated wrt time
    
    A = Matrix(len(ymat),len(ymat),lambda i,j:0)
    for i in range(A.rows):
        for k in range(A.cols):
            Aik = S[i,0]*diff(a[0],ymat[k])
            for j in range(1,len(a)):
                Aik += S[i,j]*diff(a[j],ymat[k])
            A[i,k] = Aik

#    E = Matrix(len(ymat),len(a),lambda i,j:0)
#    for i in range(len(ymat)):
#        for k in range(len(a)):
#            E[i,k] = S[i,k]*(a[k]**(-0.5))
 <commit_msg>moved some of the code into if __name__ == __main__ block so it does not interfere with tests<commit_after>from sympy import Matrix,Symbol,diff,latex
#from create_cfile_LNA import create_c
if __name__ == '__main__':
    import os
    import sys
    model_ = sys.argv[1]
    LNAout = sys.argv[2]
    os.system('python formatmodel.py '+model_)

    from model import model

    [S,a,nreactions,nvariables,ymat,Mumat,c] = model()


def LNA(S,a,ymat,c,LNAout):

    dPdt = Matrix(len(ymat),1,lambda i,j:0)
    for i in range(len(ymat)):
        dPidt = S[i,0]*a[0]
        for j in range(1,len(a)):
            dPidt += S[i,j]*a[j]
        dPdt[i] = dPidt  #Matrix of the deterministic parts of each species differentiated wrt time
    
    A = Matrix(len(ymat),len(ymat),lambda i,j:0)
    for i in range(A.rows):
        for k in range(A.cols):
            Aik = S[i,0]*diff(a[0],ymat[k])
            for j in range(1,len(a)):
                Aik += S[i,j]*diff(a[j],ymat[k])
            A[i,k] = Aik

#    E = Matrix(len(ymat),len(a),lambda i,j:0)
#    for i in range(len(ymat)):
#        for k in range(len(a)):
#            E[i,k] = S[i,k]*(a[k]**(-0.5))
 
{'fraction_non_alphanumeric': 0.1649058337161231, 'fraction_numerical': 0.012861736334405145, 'mean_word_length': 2.78125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '497178', 'n_tokens_mistral': 906, 'n_tokens_neox': 882, 'n_words': 197}