Beispiel #1
0
def run_correlation(bubble, yso, outfile, binStep=0.2):
    """Cross correlate and write to file

    Parameters
    ----------
    bubble : astropy Table
    yso : astropy Table
    outfile : str
    """
    theta, corr, err = calc_corr(bubble, yso, corrType='x',
                                 rSize=50, nbStrap=100, binStep=binStep)
    t = Table([theta, corr, err], names=['theta', 'w', 'dw'])
    t.write(outfile, format='ascii', delimiter=',')
# do counts for the different source types:
types=np.unique(yso['type'])
counts=np.zeros((len(types),3))
for i in range(0,len(types)):
    counts[i,0] = np.size(yso[yso['type'] == types[i]])



# the divSample function is kind of independent but I've included it in the calc_corr file.
dr1_assoc, dr1_assoc2, dr1_control = calc_corr.divSample(yso, dr1)


#sample correlation calls, with optional data file output of the results:

# all MWP bubbles and RMS sources:
mwprms_theta, mwprms_corr, mwprms_err = calc_corr.calc_corr(dr1, yso, corrType='x', rSize=50, nbStrap=100, binStep=0.2)
x=writeData(mwprms_theta, mwprms_corr, mwprms_err, outFile='mwprms_all.dat', bubCat='dr1', ysoCat='rms', rSize=50, nbStrap=100 )

# just the large bubbles and RMS sources:
mwpLrms_theta, mwpLrms_corr, mwpLrms_err = calc_corr.calc_corr(dr1L, yso, corrType='x', rSize=50, nbStrap=100, binStep=0.2)
y=writeData(mwpLrms_theta, mwpLrms_corr, mwpLrms_err, outFile='mwpLrms.dat', bubCat='dr1L', ysoCat='rms', rSize=50, nbStrap=100 )

# RMS YSOs auto-correlations:
ysodr1_theta, ysodr1_acorr, ysodr1_err = calc_corr.calc_corr(dr1, yso, corrType='a', rSize=50, nbStrap=100, binStep=0.5)
z=writeData(ysodr1_theta, ysodr1_acorr, ysodr1_err, outFile='mwpyso_acorr_all.dat', bubCat='dr1', ysoCat='rms all', rSize=50, nbStrap=100 )

# Sample correlation function plot:

mwpFig = plt.figure()
plt.errorbar(mwprms_theta, mwprms_corr, yerr=mwprms_err, c='k', marker='o', ls='None', mew=1.5, mec='k', mfc='None', label='MWP all + RMS YSOs')
plt.errorbar(mwpLrms_theta, mwpLrms_corr, yerr=mwpLrms_err, c='r', marker='x', ls='None', mew=1.5, mec='r', mfc='None', label='MWP-L + RMS YSOs')
# do counts for the different source types:
types=np.unique(yso['type'])
counts=np.zeros((len(types),3))
for i in range(0,len(types)):
    counts[i,0] = np.size(yso[yso['type'] == types[i]])



# the divSample function is kind of independent but I've included it in the calc_corr file.
dr1_assoc, dr1_assoc2, dr1_control = calc_corr.divSample(yso, dr1)


#sample correlation calls, with optional data file output of the results:

# all MWP bubbles and RMS sources:
mwprms_theta, mwprms_corr, mwprms_err = calc_corr.calc_corr(dr1, yso, corrType='x', rSize=10, nbStrap=10, binStep=0.2)
#x=writeData(mwprms_theta, mwprms_corr, mwprms_err, outFile='mwprms_all.dat', bubCat='dr1', ysoCat='rms', rSize=50, nbStrap=100 )

# just the large bubbles and RMS sources:
#mwpLrms_theta, mwpLrms_corr, mwpLrms_err = calc_corr.calc_corr(dr1L, yso, corrType='x', rSize=50, nbStrap=100, binStep=0.2)
#y=writeData(mwpLrms_theta, mwpLrms_corr, mwpLrms_err, outFile='mwpLrms.dat', bubCat='dr1L', ysoCat='rms', rSize=50, nbStrap=100 )

# RMS YSOs auto-correlations:
#ysodr1_theta, ysodr1_acorr, ysodr1_err = calc_corr.calc_corr(dr1, yso, corrType='a', rSize=50, nbStrap=100, binStep=0.5)
#z=writeData(ysodr1_theta, ysodr1_acorr, ysodr1_err, outFile='mwpyso_acorr_all.dat', bubCat='dr1', ysoCat='rms all', rSize=50, nbStrap=100 )

# Sample correlation function plot:

mwpFig = plt.figure()

plt.errorbar(mwprms_theta, mwprms_corr, yerr=mwprms_err, c='k', marker='o', ls='None', mew=1.5, mec='k', mfc='None', label='MWP all + RMS YSOs')
# Add any additional clipping criteria here:
# do counts for the different source types:
types = np.unique(yso['type'])
counts = np.zeros((len(types), 3))
for i in range(0, len(types)):
    counts[i, 0] = np.size(yso[yso['type'] == types[i]])

# the divSample function is kind of independent but I've included it in the calc_corr file.
dr1_assoc, dr1_assoc2, dr1_control = calc_corr.divSample(yso, dr1)

#sample correlation calls, with optional data file output of the results:

# all MWP bubbles and RMS sources:
mwprms_theta, mwprms_corr, mwprms_err = calc_corr.calc_corr(dr1,
                                                            yso,
                                                            corrType='x',
                                                            rSize=50,
                                                            nbStrap=100,
                                                            binStep=0.2)
x = writeData(mwprms_theta,
              mwprms_corr,
              mwprms_err,
              outFile='mwprms_all.dat',
              bubCat='dr1',
              ysoCat='rms',
              rSize=50,
              nbStrap=100)

# just the large bubbles and RMS sources:
mwpLrms_theta, mwpLrms_corr, mwpLrms_err = calc_corr.calc_corr(dr1L,
                                                               yso,
                                                               corrType='x',