<jupyter_start><jupyter_text>Distribution of chi-square<jupyter_code>###########################################################################
# Plot the chi square distribution for the average chi rotation curve and
#    separate the distributions into walls and voids.
#--------------------------------------------------------------------------
#avg_chi_square_rot_hist = plt.figure()
plt.figure(figsize=(7,5))
plt.title("$\chi^2$ Distribtuion")
# -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -

plt.hist( avg_chi_square_rot_other, BINS, color='g', density=True, 
         histtype='step', linewidth=lwidth, linestyle='--', label='Other')
# p = norm.pdf(x,
#              avg_chi_square_rot_other_mean, avg_chi_square_rot_other_stdev)
# plt.plot(x, p, 'g--', linewidth=2)
# plt.axvline( avg_chi_square_rot_other_mean,
#             color='green', linestyle='-', linewidth=1.5)
# plt.axvline(
#         avg_chi_square_rot_other_mean + avg_chi_square_rot_other_stdev,
#         color='green', linestyle=':', linewidth=1)
# plt.axvline(
#         avg_chi_square_rot_other_mean - avg_chi_square_rot_other_stdev,
#         color='green', linestyle=':', linewidth=1)
# plt.axvline(
#         avg_chi_square_rot_other_mean + 2*avg_chi_square_rot_other_stdev,
#         color='green', linestyle=':', linewidth=1)
# plt.axvline(
#         avg_chi_square_rot_other_mean - 2*avg_chi_square_rot_other_stdev,
#         color='green', linestyle=':', linewidth=1)
# _, mean_avg_chi_square_rot_other_ = plt.ylim()
# plt.text(avg_chi_square_rot_other_mean + avg_chi_square_rot_other_mean/10,
#      mean_avg_chi_square_rot_other_ - mean_avg_chi_square_rot_other_/10,
#      'Mean: {:.2f}'.format( avg_chi_square_rot_other_mean))


plt.hist( avg_chi_square_rot_void, BINS, color='r', density=True, 
         histtype='step', linewidth=lwidth, label='Void')
# p = norm.pdf(x,
#              avg_chi_square_rot_void_mean, avg_chi_square_rot_void_stdev)
# plt.plot(x, p, 'r--', linewidth=2)
# plt.axvline( avg_chi_square_rot_void_mean,
#             color='red', linestyle='-', linewidth=1.5)
# plt.axvline( avg_chi_square_rot_void_mean + avg_chi_square_rot_void_stdev,
#             color='red', linestyle=':', linewidth=1)
# plt.axvline( avg_chi_square_rot_void_mean - avg_chi_square_rot_void_stdev,
#             color='red', linestyle=':', linewidth=1)
# plt.axvline(
#         avg_chi_square_rot_void_mean + 2*avg_chi_square_rot_void_stdev,
#         color='red', linestyle=':', linewidth=1)
# plt.axvline(
#         avg_chi_square_rot_void_mean - 2*avg_chi_square_rot_void_stdev,
#         color='red', linestyle=':', linewidth=1)
# _, mean_void_avg_chi_square_rot_ = plt.ylim()
# plt.text(avg_chi_square_rot_void_mean + avg_chi_square_rot_void_mean/10,
#      mean_void_avg_chi_square_rot_ - mean_void_avg_chi_square_rot_/10,
#      'Mean: {:.2f}'.format( avg_chi_square_rot_void_mean))


plt.hist( avg_chi_square_rot_wall, BINS, color='k', density=True, 
         histtype='step', linewidth=lwidth, linestyle=':', label='Wall')
# p = norm.pdf(x,
#              avg_chi_square_rot_wall_mean, avg_chi_square_rot_wall_stdev)
# plt.plot(x, p, 'k--', linewidth=2)
# plt.axvline( avg_chi_square_rot_wall_mean,
#             color='black', linestyle='-', linewidth=1.5)
# plt.axvline( avg_chi_square_rot_wall_mean + avg_chi_square_rot_wall_stdev,
#             color='black', linestyle=':', linewidth=1)
# plt.axvline( avg_chi_square_rot_wall_mean - avg_chi_square_rot_wall_stdev,
#             color='black', linestyle=':', linewidth=1)
# plt.axvline(
#         avg_chi_square_rot_wall_mean + 2*avg_chi_square_rot_wall_stdev,
#         color='black', linestyle=':', linewidth=1)
# plt.axvline(
#         avg_chi_square_rot_wall_mean - 2*avg_chi_square_rot_wall_stdev,
#         color='black', linestyle=':', linewidth=1)
# _, mean_wall_avg_chi_square_rot_ = plt.ylim()
# plt.text(avg_chi_square_rot_wall_mean + avg_chi_square_rot_wall_mean/10,
#      mean_wall_avg_chi_square_rot_ - mean_wall_avg_chi_square_rot_/10,
#      'Mean: {:.2f}'.format( avg_chi_square_rot_wall_mean))


#ax = avg_chi_square_rot_hist.add_subplot(111)
plt.tick_params( axis='both', direction='in')
#ax.yaxis.set_ticks_position('both')
#ax.xaxis.set_ticks_position('both')
plt.ylabel('Galaxy fraction')
plt.xlabel('$\chi^2$ (Goodness of Fit)')
plt.legend()

# textstr = '\n'.join((
#       r'STDEV: $%.2f$' % ( avg_chi_square_rot_other_stdev, ),
#       r'$STDEV_{wall}$: $%.2f$' % ( avg_chi_square_rot_wall_stdev, ),
#       r'$STDEV_{void}$: $%.2f$' % ( avg_chi_square_rot_void_stdev, ),
#       r'RMS: $%.2f$' % ( avg_chi_square_rot_other_rms, ),
#       r'$RMS_{wall}$: $%.2f$' % ( avg_chi_square_rot_wall_rms, ),
#       r'$RMS_{void}$: $%.2f$' % ( avg_chi_square_rot_void_rms, )))

# props = dict( boxstyle='round', facecolor='cornsilk', alpha=0.6)

# ax.text(0.72, 0.95, textstr,
#         verticalalignment='top', horizontalalignment='left',
#         transform=ax.transAxes,
#         color='black', fontsize=8, bbox=props)

'''
plt.savefig( IMAGE_DIR + '/histograms/avg_chi_square_hist.' + IMAGE_FORMAT,
            format=IMAGE_FORMAT)
'''
#plt.show()
#plt.close()
###########################################################################<jupyter_output><empty_output><jupyter_text>Distribution of chi square for positive curves<jupyter_code>###########################################################################
# Plot the chi square distribution for the maximum chi rotation curve and
#    separate the distributions into walls and voids.
#--------------------------------------------------------------------------
#pos_chi_square_rot_hist = plt.figure()
plt.figure(figsize=(7,5))
plt.title("$\chi^2$ Distribution (Positive)")
# -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
plt.hist( pos_chi_square_rot_other, BINS, color='g', density=True, 
         histtype='step', linewidth=lwidth, linestyle='--', label='Other')
# p = norm.pdf(x,
#              pos_chi_square_rot_other_mean, pos_chi_square_rot_other_stdev)
# plt.plot(x, p, color='purple', linestyle='--', linewidth=2)
# plt.axvline( pos_chi_square_rot_other_mean,
#             color='purple', linestyle='-', linewidth=1.5)
# plt.axvline(
#         pos_chi_square_rot_other_mean + pos_chi_square_rot_other_stdev,
#         color='purple', linestyle=':', linewidth=1)
# plt.axvline(
#         pos_chi_square_rot_other_mean - pos_chi_square_rot_other_stdev,
#         color='purple', linestyle=':', linewidth=1)
# plt.axvline(
#         pos_chi_square_rot_other_mean + 2*pos_chi_square_rot_other_stdev,
#         color='purple', linestyle=':', linewidth=1)
# plt.axvline(
#         pos_chi_square_rot_other_mean - 2*pos_chi_square_rot_other_stdev,
#         color='purple', linestyle=':', linewidth=1)
# _, mean_pos_chi_square_rot_other_ = plt.ylim()
# plt.text(pos_chi_square_rot_other_mean + pos_chi_square_rot_other_mean/10,
#      mean_pos_chi_square_rot_other_ - mean_pos_chi_square_rot_other_/10,
#      'Mean: {:.2f}'.format( pos_chi_square_rot_other_mean))


plt.hist( pos_chi_square_rot_void, BINS, color='r', density=True, 
         histtype='step', linewidth=lwidth, label='Void')
# p = norm.pdf(x,
#              pos_chi_square_rot_void_mean, pos_chi_square_rot_void_stdev)
# plt.plot(x, p, 'r--', linewidth=2)
# plt.axvline( pos_chi_square_rot_void_mean,
#             color='red', linestyle='-', linewidth=1.5)
# plt.axvline( pos_chi_square_rot_void_mean + pos_chi_square_rot_void_stdev,
#             color='red', linestyle=':', linewidth=1)
# plt.axvline( pos_chi_square_rot_void_mean - pos_chi_square_rot_void_stdev,
#             color='red', linestyle=':', linewidth=1)
# plt.axvline(
#         pos_chi_square_rot_void_mean + 2*pos_chi_square_rot_void_stdev,
#         color='red', linestyle=':', linewidth=1)
# plt.axvline(
#         pos_chi_square_rot_void_mean - 2*pos_chi_square_rot_void_stdev,
#         color='red', linestyle=':', linewidth=1)
# _, mean_void_pos_chi_square_rot_ = plt.ylim()
# plt.text(pos_chi_square_rot_void_mean + pos_chi_square_rot_void_mean/10,
#      mean_void_pos_chi_square_rot_ - mean_void_pos_chi_square_rot_/10,
#      'Mean: {:.2f}'.format( pos_chi_square_rot_void_mean))


plt.hist( pos_chi_square_rot_wall, BINS, color='k', density=True, 
         histtype='step', linewidth=lwidth, linestyle=':', label='Wall')
# p = norm.pdf(x,
#              pos_chi_square_rot_wall_mean, pos_chi_square_rot_wall_stdev)
# plt.plot(x, p, 'k--', linewidth=2)
# plt.axvline( pos_chi_square_rot_wall_mean,
#             color='black', linestyle='-', linewidth=1.5)
# plt.axvline( pos_chi_square_rot_wall_mean + pos_chi_square_rot_wall_stdev,
#             color='black', linestyle=':', linewidth=1)
# plt.axvline( pos_chi_square_rot_wall_mean - pos_chi_square_rot_wall_stdev,
#             color='black', linestyle=':', linewidth=1)
# plt.axvline(
#         pos_chi_square_rot_wall_mean + 2*pos_chi_square_rot_wall_stdev,
#         color='black', linestyle=':', linewidth=1)
# plt.axvline(
#         pos_chi_square_rot_wall_mean - 2*pos_chi_square_rot_wall_stdev,
#         color='black', linestyle=':', linewidth=1)
# _, mean_wall_pos_chi_square_rot_ = plt.ylim()
# plt.text(pos_chi_square_rot_wall_mean + pos_chi_square_rot_wall_mean/10,
#      mean_wall_pos_chi_square_rot_ - mean_wall_pos_chi_square_rot_/10,
#      'Mean: {:.2f}'.format( pos_chi_square_rot_wall_mean))


#ax = pos_chi_square_rot_hist.add_subplot(111)
plt.tick_params( axis='both', direction='in')
#ax.yaxis.set_ticks_position('both')
#ax.xaxis.set_ticks_position('both')
plt.ylabel('Galaxy fraction')
plt.xlabel('$\chi^2$ (Goodness of Fit)')
plt.legend()

# textstr = '\n'.join((
#       r'STDEV: $%.2f$' % ( pos_chi_square_rot_other_stdev, ),
#       r'$STDEV_{wall}$: $%.2f$' % ( pos_chi_square_rot_wall_stdev, ),
#       r'$STDEV_{void}$: $%.2f$' % ( pos_chi_square_rot_void_stdev, ),
#       r'RMS: $%.2f$' % ( pos_chi_square_rot_other_rms, ),
#       r'$RMS_{wall}$: $%.2f$' % ( pos_chi_square_rot_wall_rms, ),
#       r'$RMS_{void}$: $%.2f$' % ( pos_chi_square_rot_void_rms, )))

# props = dict( boxstyle='round', facecolor='cornsilk', alpha=0.6)

# ax.text(0.72, 0.95, textstr,
#         verticalalignment='top', horizontalalignment='left',
#         transform=ax.transAxes,
#         color='black', fontsize=8, bbox=props)

'''
plt.savefig( IMAGE_DIR + '/histograms/pos_chi_square_hist.' + IMAGE_FORMAT,
            format=IMAGE_FORMAT)
'''
#plt.show()
#plt.close()
###########################################################################<jupyter_output><empty_output><jupyter_text>Distribution of chi square for negative rotation curve<jupyter_code>###########################################################################
# Plot the chi square distribution for the negative rotation curve and
#    separate the distributions into walls and voids.
#--------------------------------------------------------------------------
#neg_chi_square_rot_hist = plt.figure()
plt.figure(figsize=(7,5))
plt.title("$\chi^2$ Distribution (Negative)")


plt.hist( neg_chi_square_rot_other, BINS, color='g', density=True, 
         histtype='step', linewidth=lwidth, linestyle='--', label='Other')
# p = norm.pdf(x,
#              neg_chi_square_rot_other_mean, neg_chi_square_rot_other_stdev)
# plt.plot(x, p, 'g--', linewidth=2)
# plt.axvline( neg_chi_square_rot_other_mean,
#             color='blue', linestyle='-', linewidth=1.5)
# plt.axvline(
#         neg_chi_square_rot_other_mean + neg_chi_square_rot_other_stdev,
#         color='blue', linestyle=':', linewidth=1)
# plt.axvline(
#         neg_chi_square_rot_other_mean - neg_chi_square_rot_other_stdev,
#         color='blue', linestyle=':', linewidth=1)
# plt.axvline(
#         neg_chi_square_rot_other_mean + 2*neg_chi_square_rot_other_stdev,
#         color='blue', linestyle=':', linewidth=1)
# plt.axvline(
#         neg_chi_square_rot_other_mean - 2*neg_chi_square_rot_other_stdev,
#         color='blue', linestyle=':', linewidth=1)
# _, mean_neg_chi_square_rot_other_ = plt.ylim()
# plt.text(neg_chi_square_rot_other_mean + neg_chi_square_rot_other_mean/10,
#      mean_neg_chi_square_rot_other_ - mean_neg_chi_square_rot_other_/10,
#      'Mean: {:.2f}'.format( neg_chi_square_rot_other_mean))


plt.hist( neg_chi_square_rot_void, BINS, color='r', density=True, 
         histtype='step', linewidth=lwidth, label='Void')
# p = norm.pdf(x,
#              neg_chi_square_rot_void_mean, neg_chi_square_rot_void_stdev)
# plt.plot(x, p, 'r--', linewidth=2)
# plt.axvline( neg_chi_square_rot_void_mean,
#             color='red', linestyle='-', linewidth=1.5)
# plt.axvline( neg_chi_square_rot_void_mean + neg_chi_square_rot_void_stdev,
#             color='red', linestyle=':', linewidth=1)
# plt.axvline( neg_chi_square_rot_void_mean - neg_chi_square_rot_void_stdev,
#             color='red', linestyle=':', linewidth=1)
# plt.axvline(
#         neg_chi_square_rot_void_mean + 2*neg_chi_square_rot_void_stdev,
#         color='red', linestyle=':', linewidth=1)
# plt.axvline(
#         neg_chi_square_rot_void_mean - 2*neg_chi_square_rot_void_stdev,
#         color='red', linestyle=':', linewidth=1)
# _, mean_void_neg_chi_square_rot_ = plt.ylim()
# plt.text(neg_chi_square_rot_void_mean + neg_chi_square_rot_void_mean/10,
#      mean_void_neg_chi_square_rot_ - mean_void_neg_chi_square_rot_/10,
#      'Mean: {:.2f}'.format( neg_chi_square_rot_void_mean))


plt.hist( neg_chi_square_rot_wall, BINS, color='k', density=True, 
         histtype='step', linewidth=lwidth, linestyle=':', label='Wall')
# p = norm.pdf(x,
#              neg_chi_square_rot_wall_mean, neg_chi_square_rot_wall_stdev)
# plt.plot(x, p, 'k--', linewidth=2)
# plt.axvline( neg_chi_square_rot_wall_mean,
#             color='black', linestyle='-', linewidth=1.5)
# plt.axvline( neg_chi_square_rot_wall_mean + neg_chi_square_rot_wall_stdev,
#             color='black', linestyle=':', linewidth=1)
# plt.axvline( neg_chi_square_rot_wall_mean - neg_chi_square_rot_wall_stdev,
#             color='black', linestyle=':', linewidth=1)
# plt.axvline(
#         neg_chi_square_rot_wall_mean + 2*neg_chi_square_rot_wall_stdev,
#         color='black', linestyle=':', linewidth=1)
# plt.axvline(
#         neg_chi_square_rot_wall_mean - 2*neg_chi_square_rot_wall_stdev,
#         color='black', linestyle=':', linewidth=1)
# _, mean_wall_neg_chi_square_rot_ = plt.ylim()
# plt.text(neg_chi_square_rot_wall_mean + neg_chi_square_rot_wall_mean/10,
#      mean_wall_neg_chi_square_rot_ - mean_wall_neg_chi_square_rot_/10,
#      'Mean: {:.2f}'.format( neg_chi_square_rot_wall_mean))


#ax = neg_chi_square_rot_hist.add_subplot(111)
plt.tick_params( axis='both', direction='in')
#ax.yaxis.set_ticks_position('both')
#ax.xaxis.set_ticks_position('both')
plt.ylabel('Galaxy fraction')
plt.xlabel('$\chi^2$ (Goodness of Fit)')
plt.legend()

# textstr = '\n'.join((
#       r'STDEV: $%.2f$' % ( neg_chi_square_rot_other_stdev, ),
#       r'$STDEV_{wall}$: $%.2f$' % ( neg_chi_square_rot_wall_stdev, ),
#       r'$STDEV_{void}$: $%.2f$' % ( neg_chi_square_rot_void_stdev, ),
#       r'RMS: $%.2f$' % ( neg_chi_square_rot_other_rms, ),
#       r'$RMS_{wall}$: $%.2f$' % ( neg_chi_square_rot_wall_rms, ),
#       r'$RMS_{void}$: $%.2f$' % ( neg_chi_square_rot_void_rms, )))

# props = dict( boxstyle='round', facecolor='cornsilk', alpha=0.6)

# ax.text(0.72, 0.95, textstr,
#         verticalalignment='top', horizontalalignment='left',
#         transform=ax.transAxes,
#         color='black', fontsize=8, bbox=props)

'''
plt.savefig( IMAGE_DIR + '/histograms/neg_chi_square_hist.' + IMAGE_FORMAT,
            format=IMAGE_FORMAT)
'''
#plt.show()
#plt.close()
###########################################################################<jupyter_output><empty_output><jupyter_text>Relationship between chi square and mass ratio<jupyter_code>plt.figure( figsize=(7,5))

plt.loglog( avg_chi_square_rot_other, mass_ratio_other, 'go', markersize=msize, 
         fillstyle='none', label='Other')
plt.loglog( avg_chi_square_rot_wall, mass_ratio_wall, 'k^', markersize=msize, 
         label='Wall')
plt.loglog( avg_chi_square_rot_void, mass_ratio_void, 'ro', markersize=msize, 
         label='Void')

plt.xlabel('$\chi^2$ (Goodness of Fit)')
plt.ylabel('$M_{DM}/M_*$')
plt.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.185459668034544, 'fraction_numerical': 0.011943406627059472, 'mean_word_length': 4.327243066884177, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '418603', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 6401, 'n_tokens_neox': 6279, 'n_words': 782, 'path': 'notebooks/analyze_chi_square.ipynb', 'repo_name': 'kadglass/RotationCurves', 'size': '16327'}