# Compare the calculated mean firing rate with the reference values saved in M2E_reference_MFRs.json and calculate the percentage of matching
# Compare the calculated mean firing rate with the reference values saved in M2E_reference_MFRs.json and calculate the percentage of matching
# Load the array
# Load the array
pop_rates_ref=np.load('M2E_pop_rates_ref.npy')
pop_rates_ref=np.load('M2E_pop_rates_ref.npy')
# Count the percentage of cells that values match (the same)
# Count the percentage of cells that values match (the same)
comparison_result=pop_rates_ref==rates
comparison_result=pop_rates_ref==rates
# print(comparison_result)
# print(comparison_result)
same_cells=np.sum(comparison_result)
same_cells=np.sum(comparison_result)
# print(same_cells)
# print(same_cells)
total_cells=np.prod(pop_rates_ref.shape)
total_cells=np.prod(pop_rates_ref.shape)
# print(total_cells)
# print(total_cells)
match_rate=same_cells/total_cells
match_rate=same_cells/total_cells
# print(match_rate)
# print(match_rate)
# Judge if the matching rate is lower than threshold set and raise error if yes
# Judge if the matching rate is lower than threshold set and raise error if yes
ifmatch_rate<match_rate_threshold:
ifmatch_rate<match_rate_threshold:
raiseTestError("Mismatch of mean firing rates over populations between the latest simulation and saved reference values, there may be problems of recent updates of dependencies, please take a check!")
raiseTestError("Mismatch of mean firing rates over populations between the latest simulation and saved reference values, there may be problems of recent updates of dependencies, please take a check!")