James McCool commited on
Commit
fa88775
·
1 Parent(s): e4db190

Added vectorization for 'cpt_Projection_map' in sim_contest function to enhance performance and maintain consistency in simulation calculations.

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -203,6 +203,7 @@ def sim_contest(Sim_size, seed_frame, maps_dict, sharp_split, Contest_Size):
203
 
204
  # Pre-vectorize functions
205
  vec_projection_map = np.vectorize(maps_dict['Projection_map'].__getitem__)
 
206
  vec_stdev_map = np.vectorize(maps_dict['STDev_map'].__getitem__)
207
 
208
  st.write('Simulating contest on frames')
@@ -214,7 +215,7 @@ def sim_contest(Sim_size, seed_frame, maps_dict, sharp_split, Contest_Size):
214
  fp_random,
215
  np.sum(np.random.normal(
216
  loc=np.where(np.arange(fp_random.shape[1]) == 0, # Check if it's the first column
217
- cpt_projection_map(fp_random[:, :-7]), # Use cpt_projection_map for first column
218
  vec_projection_map(fp_random[:, :-7])), # Use original for other columns
219
  scale=vec_stdev_map(fp_random[:, :-7])),
220
  axis=1)
 
203
 
204
  # Pre-vectorize functions
205
  vec_projection_map = np.vectorize(maps_dict['Projection_map'].__getitem__)
206
+ vec_cpt_projection_map = np.vectorize(maps_dict['cpt_Projection_map'].__getitem__)
207
  vec_stdev_map = np.vectorize(maps_dict['STDev_map'].__getitem__)
208
 
209
  st.write('Simulating contest on frames')
 
215
  fp_random,
216
  np.sum(np.random.normal(
217
  loc=np.where(np.arange(fp_random.shape[1]) == 0, # Check if it's the first column
218
+ vec_cpt_projection_map(fp_random[:, :-7]), # Use cpt_projection_map for first column
219
  vec_projection_map(fp_random[:, :-7])), # Use original for other columns
220
  scale=vec_stdev_map(fp_random[:, :-7])),
221
  axis=1)