@@ -420,8 +420,8 @@ def metabolism(self,day):
420420 # Update Substrates pools with dead enzymes
421421 DeadEnz_df = pd .concat (
422422 [Enzyme_Loss ,
423- Enzyme_Loss .mul (self .Enz_Attrib ['N_cost' ].tolist () * self .gridsize , axis = 0 ),
424- Enzyme_Loss .mul (self .Enz_Attrib ['P_cost' ].tolist () * self .gridsize , axis = 0 )],
423+ Enzyme_Loss .mul (np . repeat ( self .Enz_Attrib ['N_cost' ].values , self .gridsize ), axis = 0 ),
424+ Enzyme_Loss .mul (np . repeat ( self .Enz_Attrib ['P_cost' ].values , self .gridsize ), axis = 0 )],
425425 axis = 1
426426 )
427427 DeadEnz_df .index = [np .arange (self .gridsize ).repeat (self .n_enzymes ), DeadEnz_df .index ] # create a multi-index
@@ -713,5 +713,5 @@ def reinitialization(self,initialization,microbes_pp,output,mode,pulse,*args):
713713 # last: assign microbes to each grid box randomly based on prior densities
714714 choose_taxa = np .zeros ((self .n_taxa ,self .gridsize ), dtype = 'int8' )
715715 for i in range (self .n_taxa ):
716- choose_taxa [i ,:] = np .random .choice ([ 1 , 0 ], self . gridsize , replace = True , p = [ frequencies [i ], 1 - frequencies [ i ]] )
716+ choose_taxa [i ,:] = np .random .binomial ( 1 , frequencies [i ], self . gridsize )
717717 self .Microbes .loc [np .ravel (choose_taxa ,order = 'F' )== 0 ] = np .float32 (0 ) # NOTE order='F'
0 commit comments