Esempio n. 1
0
def makePlot(args):
    """
  Make the plot with radial velocity performance predictions.

  :argument args: command line arguments
  """
    gRvs = np.linspace(5.7, 16.1, 101)

    spts = [
        'B0V', 'B5V', 'A0V', 'A5V', 'F0V', 'G0V', 'G5V', 'K0V', 'K1IIIMP',
        'K4V', 'K1III'
    ]

    fig = plt.figure(figsize=(10, 6.5))
    deltaHue = 240.0 / (len(spts) - 1)
    hsv = np.zeros((1, 1, 3))
    hsv[0, 0, 1] = 1.0
    hsv[0, 0, 2] = 0.9
    count = 0
    for spt in spts:
        hsv[0, 0, 0] = (240 - count * deltaHue) / 360.0
        vmag = vminGrvsFromVmini(vminiFromSpt(spt)) + gRvs
        vradErrors = vradErrorSkyAvg(vmag, spt)
        plt.plot(vmag,
                 vradErrors,
                 '-',
                 label=spt,
                 color=hsv_to_rgb(hsv)[0, 0, :])
        count += 1
    plt.grid(which='both')
    plt.xlim(9, 17.5)
    plt.ylim(0, 20)
    plt.xticks(np.arange(9, 18, 1))
    plt.yticks(np.arange(0, 20.5, 5))
    plt.xlabel('$V$ [mag]')
    plt.ylabel('End-of-mission radial velocity error [km s$^{-1}$]')
    leg = plt.legend(loc=0, handlelength=2.0, labelspacing=0.10)
    for t in leg.get_texts():
        t.set_fontsize(12)

    if (args['pdfOutput']):
        plt.savefig('RadialVelocityErrors.pdf')
    elif (args['pngOutput']):
        plt.savefig('RadialVelocityErrors.png')
    else:
        plt.show()
def makePlot(args):
  """
  Make the plot with radial velocity performance predictions.

  :argument args: command line arguments
  """
  gRvs=np.linspace(5.7,16.1,101)

  spts=['B0V', 'B5V', 'A0V', 'A5V', 'F0V', 'G0V',
        'G5V', 'K0V', 'K1IIIMP', 'K4V', 'K1III']

  fig=plt.figure(figsize=(10,6.5))
  deltaHue = 240.0/(len(spts)-1)
  hsv=np.zeros((1,1,3))
  hsv[0,0,1]=1.0
  hsv[0,0,2]=0.9
  count=0
  for spt in spts:
    hsv[0,0,0]=(240-count*deltaHue)/360.0
    vmag = vminGrvsFromVmini(vminiFromSpt(spt)) + gRvs
    vradErrors = vradErrorSkyAvg(vmag, spt)
    plt.plot(vmag, vradErrors, '-', label=spt, color=hsv_to_rgb(hsv)[0,0,:])
    count+=1
  plt.grid(which='both')
  plt.xlim(9,17.5)
  plt.ylim(0,20)
  plt.xticks(np.arange(9,18,1))
  plt.yticks(np.arange(0,20.5,5))
  plt.xlabel('$V$ [mag]')
  plt.ylabel('End-of-mission radial velocity error [km s$^{-1}$]')
  leg=plt.legend(loc=0,  handlelength=2.0, labelspacing=0.10)
  for t in leg.get_texts():
    t.set_fontsize(12)

  if (args['pdfOutput']):
    plt.savefig('RadialVelocityErrors.pdf')
  elif (args['pngOutput']):
    plt.savefig('RadialVelocityErrors.png')
  else:
    plt.show()
Esempio n. 3
0
def makePlot(args):
  """
  Make the plot with parallax horizons. The plot shows V-band magnitude vs distance for a number of
  spectral types and over the range 5.7<G<20. In addition a set of crudely drawn contours show the points
  where 0.1, 1, and 10 per cent relative parallax accracy are reached.

  Parameters
  ----------
  
  args - Command line arguments.
  """
  distances = 10.0**np.linspace(1,6,10001)
  av = args['extinction']
  ai = 0.479*av #Cardelli et al R=3.1

  spts = ['B0I', 'B1V', 'G2V', 'K4V', 'M0V', 'M6V', 'K1III', 'M0III']
  pointOnePercD = []
  pointOnePercV = []
  onePercD = []
  onePercV = []
  tenPercD = []
  tenPercV = []
  vabsPointOnePerc = []
  vabsOnePerc = []
  vabsTenPerc = []

  fig=plt.figure(figsize=(11,7.8))
  deltaHue = 240.0/(len(spts)-1)
  hues = (240.0-np.arange(len(spts))*deltaHue)/360.0
  hsv=np.zeros((1,1,3))
  hsv[0,0,1]=1.0
  hsv[0,0,2]=0.9
  for hue,spt in zip(hues, spts):
    hsv[0,0,0]=hue
    vmags = vabsFromSpt(spt)+5.0*np.log10(distances)-5.0+av
    vmini=vminiFromSpt(spt)+av-ai
    #gmags = gabsFromSpt(spt)+5.0*np.log10(distances)-5.0
    gmags = vmags + gminvFromVmini(vmini)
    relParErr = parallaxErrorSkyAvg(gmags,vmini)*distances/1.0e6
    observed = (gmags>=5.7) & (gmags<=20.0)
    relParErrObs = relParErr[observed]
    # Identify the points where the relative parallax accuracy is 0.1, 1, or 10 per cent.
    if (relParErrObs.min()<0.001):
      index = len(relParErrObs[relParErrObs<=0.001])-1
      pointOnePercD.append(distances[observed][index])
      pointOnePercV.append(vmags[observed][index])
      vabsPointOnePerc.append(vabsFromSpt(spt))
    if (relParErrObs.min()<0.01):
      index = len(relParErrObs[relParErrObs<=0.01])-1
      onePercD.append(distances[observed][index])
      onePercV.append(vmags[observed][index])
      vabsOnePerc.append(vabsFromSpt(spt))
    if (relParErrObs.min()<0.1):
      index = len(relParErrObs[relParErrObs<=0.1])-1
      tenPercD.append(distances[observed][index])
      tenPercV.append(vmags[observed][index])
      vabsTenPerc.append(vabsFromSpt(spt))
    plt.semilogx(distances[observed], vmags[observed], '-', label=spt, color=hsv_to_rgb(hsv)[0,0,:])
    if (spt=='B0I'):
      plt.text(distances[observed][-1]-1.0e5, vmags[observed][-1], spt, horizontalalignment='right',
          verticalalignment='bottom', fontsize=14)
    else:
      plt.text(distances[observed][-1], vmags[observed][-1], spt, horizontalalignment='center',
          verticalalignment='bottom', fontsize=14)

  # Draw the "contours" of constant relative parallax accuracy.
  pointOnePercD = np.array(pointOnePercD)
  pointOnePercV = np.array(pointOnePercV)
  indices = np.argsort(vabsPointOnePerc)
  plt.semilogx(pointOnePercD[indices],pointOnePercV[indices],'k--')
  plt.text(pointOnePercD[indices][-1]*1.2,pointOnePercV[indices][-1]-2.5,"$0.1$\\%", ha='right', size=16,
      bbox=dict(boxstyle="round, pad=0.3", ec=(0.0, 0.0, 0.0), fc=(1.0, 1.0, 1.0),))

  onePercD = np.array(onePercD)
  onePercV = np.array(onePercV)
  indices = np.argsort(vabsOnePerc)
  plt.semilogx(onePercD[indices],onePercV[indices],'k--')
  plt.text(onePercD[indices][-1]*1.2,onePercV[indices][-1]-2.5,"$1$\\%", ha='right', size=16,
      bbox=dict(boxstyle="round, pad=0.3", ec=(0.0, 0.0, 0.0), fc=(1.0, 1.0, 1.0),))

  tenPercD = np.array(tenPercD)
  tenPercV = np.array(tenPercV)
  indices = np.argsort(vabsTenPerc)
  plt.semilogx(tenPercD[indices],tenPercV[indices],'k--')
  plt.text(tenPercD[indices][-1]*1.5,tenPercV[indices][-1]-2.5,"$10$\\%", ha='right', size=16,
      bbox=dict(boxstyle="round, pad=0.3", ec=(0.0, 0.0, 0.0), fc=(1.0, 1.0, 1.0),))

  plt.title('Parallax relative accuracy horizons ($A_V={0}$)'.format(av))

  plt.xlabel('Distance [pc]')
  plt.ylabel('V')
  plt.grid()
  #leg=plt.legend(loc=4, fontsize=14, labelspacing=0.5)
  plt.ylim(5,26)
  
  basename='ParallaxHorizons'
  if (args['pdfOutput']):
    plt.savefig(basename+'.pdf')
  elif (args['pngOutput']):
    plt.savefig(basename+'.png')
  else:
    plt.show()
def makePlot(args):
  """
  Make the plot with proper motion performance predictions. The predictions are for the TOTAL proper
  motion under the assumption of equal components mu_alpha* and mu_delta.

  :argument args: command line arguments
  """
  gmag=np.linspace(5.7,20.0,101)

  vminiB1V=vminiFromSpt('B1V')
  vminiG2V=vminiFromSpt('G2V')
  vminiM6V=vminiFromSpt('M6V')
  
  vmagB1V=gmag-gminvFromVmini(vminiB1V)
  vmagG2V=gmag-gminvFromVmini(vminiG2V)
  vmagM6V=gmag-gminvFromVmini(vminiM6V)

  sigmualphaB1V, sigmudeltaB1V = properMotionErrorSkyAvg(gmag,vminiB1V)
  sigmuB1V = np.sqrt(0.5*sigmualphaB1V**2+0.5*sigmudeltaB1V**2)
  sigmualphaB1V, sigmudeltaB1V = properMotionMinError(gmag,vminiB1V)
  sigmuB1Vmin = np.sqrt(0.5*sigmualphaB1V**2+0.5*sigmudeltaB1V**2)
  sigmualphaB1V, sigmudeltaB1V = properMotionMaxError(gmag,vminiB1V)
  sigmuB1Vmax = np.sqrt(0.5*sigmualphaB1V**2+0.5*sigmudeltaB1V**2)
  
  sigmualphaG2V, sigmudeltaG2V = properMotionErrorSkyAvg(gmag,vminiG2V)
  sigmuG2V = np.sqrt(0.5*sigmualphaG2V**2+0.5*sigmudeltaG2V**2)
  sigmualphaG2V, sigmudeltaG2V = properMotionMinError(gmag,vminiG2V)
  sigmuG2Vmin = np.sqrt(0.5*sigmualphaG2V**2+0.5*sigmudeltaG2V**2)
  sigmualphaG2V, sigmudeltaG2V = properMotionMaxError(gmag,vminiG2V)
  sigmuG2Vmax = np.sqrt(0.5*sigmualphaG2V**2+0.5*sigmudeltaG2V**2)
  
  sigmualphaM6V, sigmudeltaM6V = properMotionErrorSkyAvg(gmag,vminiM6V)
  sigmuM6V = np.sqrt(0.5*sigmualphaM6V**2+0.5*sigmudeltaM6V**2)
  sigmualphaM6V, sigmudeltaM6V = properMotionMinError(gmag,vminiM6V)
  sigmuM6Vmin = np.sqrt(0.5*sigmualphaM6V**2+0.5*sigmudeltaM6V**2)
  sigmualphaM6V, sigmudeltaM6V = properMotionMaxError(gmag,vminiM6V)
  sigmuM6Vmax = np.sqrt(0.5*sigmualphaM6V**2+0.5*sigmudeltaM6V**2)
  
  fig=plt.figure(figsize=(10,6.5))
  
  if (args['gmagAbscissa']):
    plt.semilogy(gmag, sigmuB1V, 'b', label='B1V')
    plt.semilogy(gmag, sigmuG2V, 'g', label='G2V')
    plt.semilogy(gmag, sigmuM6V, 'r', label='M6V')
    plt.xlim((5,20))
    plt.ylim((1,500))
    plt.legend(loc=4)
  else:
    ax=fig.add_subplot(111)
    plt.semilogy(vmagB1V, sigmuB1V, 'b', label='B1V')
    #plt.semilogy(vmagG2V, sigmuG2V, 'g', label='G2V')
    plt.semilogy(vmagM6V, sigmuM6V, 'r', label='M6V')
    plt.fill_between(vmagB1V, sigmuB1Vmin, sigmuB1Vmax, color='b', alpha=0.3)
    plt.fill_between(vmagM6V, sigmuM6Vmin, sigmuM6Vmax, color='r', alpha=0.3)
    plt.xlim((5,22.5))
    plt.ylim((1,500))
    plt.text(17.5,100,'B1V',color='b')
    plt.text(18,10,'M6V',color='r')
    plt.text(7,11,'calibration noise floor', size=12, bbox=dict(boxstyle="round,pad=0.3",
                       ec=(0.0, 0.0, 0.0),
                       fc=(1.0, 1.0, 1.0),
                       ))
    plt.text(14.75,50,'photon noise', rotation=45, size=12, bbox=dict(boxstyle="round,pad=0.3",
                       ec=(0.0, 0.0, 0.0),
                       fc=(1.0, 1.0, 1.0),
                       ))
    ax.annotate('non-uniformity\nover the sky', xy=(21.5, 80),  xycoords='data',
                  xytext=(21.5,30), textcoords='data', ha='center', size='12',
                  bbox=dict(boxstyle="round,pad=0.3",ec=(0,0,0),fc=(1,1,1)),
                  arrowprops=dict(facecolor='black', shrink=0.15, width=1,
                    headwidth=6),
                  horizontalalignment='right', verticalalignment='top',
                  )
    ax.annotate('', xy=(21.5, 170),  xycoords='data',
                  xytext=(21.5,380), textcoords='data', ha='center', size='12',
                  arrowprops=dict(facecolor='black', shrink=0.15, width=1,
                    headwidth=6),
                  horizontalalignment='right', verticalalignment='bottom',
                  )
  
  plt.xticks(np.arange(6,24,2))
  ax = plt.gca().yaxis 
  ax.set_major_formatter(matplotlib.ticker.ScalarFormatter())
  plt.ticklabel_format(axis='y',style='plain')
  plt.grid(which='both')
  plt.xlabel('$V$ [mag]')
  plt.ylabel('End-of-mission $\\sigma_\\mu$ [$\mu$as/yr]')
  
  basename = 'ProperMotionErrors'
  if (args['pdfOutput']):
    plt.savefig(basename+'.pdf')
  elif (args['pngOutput']):
    plt.savefig(basename+'.png')
  else:
    plt.show()
def makePlot(args):
    """
  Make the plot with parallax performance predictions.

  :argument args: command line arguments
  """
    gmag = np.linspace(5.7, 20.0, 101)

    vminiB1V = vminiFromSpt('B1V')
    vminiG2V = vminiFromSpt('G2V')
    vminiM6V = vminiFromSpt('M6V')

    vmagB1V = gmag - gminvFromVmini(vminiB1V)
    vmagG2V = gmag - gminvFromVmini(vminiG2V)
    vmagM6V = gmag - gminvFromVmini(vminiM6V)

    sigparB1V = parallaxErrorSkyAvg(gmag, vminiB1V)
    sigparB1Vmin = parallaxMinError(gmag, vminiB1V)
    sigparB1Vmax = parallaxMaxError(gmag, vminiB1V)

    sigparG2V = parallaxErrorSkyAvg(gmag, vminiG2V)
    sigparG2Vmin = parallaxMinError(gmag, vminiG2V)
    sigparG2Vmax = parallaxMaxError(gmag, vminiG2V)

    sigparM6V = parallaxErrorSkyAvg(gmag, vminiM6V)
    sigparM6Vmin = parallaxMinError(gmag, vminiM6V)
    sigparM6Vmax = parallaxMaxError(gmag, vminiM6V)

    fig = plt.figure(figsize=(10, 6.5))

    if (args['gmagAbscissa']):
        plt.semilogy(gmag, sigparB1V, 'b', label='B1V')
        plt.semilogy(gmag, sigparG2V, 'g', label='G2V')
        plt.semilogy(gmag, sigparM6V, 'r', label='M6V')
        plt.xlim((5, 20))
        plt.ylim((4, 1000))
        plt.legend(loc=4)
        plt.xlabel('$G$ [mag]')
    else:
        ax = fig.add_subplot(111)
        plt.semilogy(vmagB1V, sigparB1V, 'b', label='B1V')
        #plt.semilogy(vmagG2V, sigparG2V, 'g', label='G2V')
        plt.semilogy(vmagM6V, sigparM6V, 'r', label='M6V')
        plt.fill_between(vmagB1V,
                         sigparB1Vmin,
                         sigparB1Vmax,
                         color='b',
                         alpha=0.3)
        plt.fill_between(vmagM6V,
                         sigparM6Vmin,
                         sigparM6Vmax,
                         color='r',
                         alpha=0.3)
        plt.xlim((5, 22.5))
        plt.ylim((4, 1000))
        plt.text(17.2, 190, 'B1V', color='b')
        plt.text(18, 20, 'M6V', color='r')
        plt.xlabel('$V$ [mag]')
        plt.text(7,
                 17,
                 'calibration noise floor',
                 size=12,
                 bbox=dict(
                     boxstyle="round,pad=0.3",
                     ec=(0.0, 0.0, 0.0),
                     fc=(1.0, 1.0, 1.0),
                 ))
        plt.text(14.75,
                 80,
                 'photon noise',
                 rotation=45,
                 size=12,
                 bbox=dict(
                     boxstyle="round,pad=0.3",
                     ec=(0.0, 0.0, 0.0),
                     fc=(1.0, 1.0, 1.0),
                 ))
        ax.annotate(
            'non-uniformity\nover the sky',
            xy=(21.5, 320),
            xycoords='data',
            xytext=(21.5, 80),
            textcoords='data',
            ha='center',
            size='12',
            bbox=dict(boxstyle="round,pad=0.3", ec=(0, 0, 0), fc=(1, 1, 1)),
            arrowprops=dict(facecolor='black',
                            shrink=0.15,
                            width=1,
                            headwidth=6),
            horizontalalignment='right',
            verticalalignment='top',
        )
        ax.annotate(
            '',
            xy=(21.5, 500),
            xycoords='data',
            xytext=(21.5, 950),
            textcoords='data',
            ha='center',
            size='12',
            arrowprops=dict(facecolor='black',
                            shrink=0.15,
                            width=1,
                            headwidth=6),
            horizontalalignment='right',
            verticalalignment='bottom',
        )

    plt.xticks(np.arange(6, 24, 2))
    ax = plt.gca().yaxis
    ax.set_major_formatter(matplotlib.ticker.ScalarFormatter())
    plt.ticklabel_format(axis='y', style='plain')
    plt.grid(which='both')
    plt.ylabel('End-of-mission parallax standard error [$\mu$as]')

    if (args['pdfOutput']):
        plt.savefig('ParallaxErrors.pdf')
    elif (args['pngOutput']):
        plt.savefig('ParallaxErrors.png')
    else:
        plt.show()
def makePlot(args):
    """
  Make the plot with proper motion performance predictions. The predictions are for the TOTAL proper
  motion under the assumption of equal components mu_alpha* and mu_delta.

  :argument args: command line arguments
  """
    gmag = np.linspace(5.7, 20.0, 101)

    vminiB1V = vminiFromSpt('B1V')
    vminiG2V = vminiFromSpt('G2V')
    vminiM6V = vminiFromSpt('M6V')

    vmagB1V = gmag - gminvFromVmini(vminiB1V)
    vmagG2V = gmag - gminvFromVmini(vminiG2V)
    vmagM6V = gmag - gminvFromVmini(vminiM6V)

    sigmualphaB1V, sigmudeltaB1V = properMotionErrorSkyAvg(gmag, vminiB1V)
    sigmuB1V = np.sqrt(0.5 * sigmualphaB1V**2 + 0.5 * sigmudeltaB1V**2)
    sigmualphaB1V, sigmudeltaB1V = properMotionMinError(gmag, vminiB1V)
    sigmuB1Vmin = np.sqrt(0.5 * sigmualphaB1V**2 + 0.5 * sigmudeltaB1V**2)
    sigmualphaB1V, sigmudeltaB1V = properMotionMaxError(gmag, vminiB1V)
    sigmuB1Vmax = np.sqrt(0.5 * sigmualphaB1V**2 + 0.5 * sigmudeltaB1V**2)

    sigmualphaG2V, sigmudeltaG2V = properMotionErrorSkyAvg(gmag, vminiG2V)
    sigmuG2V = np.sqrt(0.5 * sigmualphaG2V**2 + 0.5 * sigmudeltaG2V**2)
    sigmualphaG2V, sigmudeltaG2V = properMotionMinError(gmag, vminiG2V)
    sigmuG2Vmin = np.sqrt(0.5 * sigmualphaG2V**2 + 0.5 * sigmudeltaG2V**2)
    sigmualphaG2V, sigmudeltaG2V = properMotionMaxError(gmag, vminiG2V)
    sigmuG2Vmax = np.sqrt(0.5 * sigmualphaG2V**2 + 0.5 * sigmudeltaG2V**2)

    sigmualphaM6V, sigmudeltaM6V = properMotionErrorSkyAvg(gmag, vminiM6V)
    sigmuM6V = np.sqrt(0.5 * sigmualphaM6V**2 + 0.5 * sigmudeltaM6V**2)
    sigmualphaM6V, sigmudeltaM6V = properMotionMinError(gmag, vminiM6V)
    sigmuM6Vmin = np.sqrt(0.5 * sigmualphaM6V**2 + 0.5 * sigmudeltaM6V**2)
    sigmualphaM6V, sigmudeltaM6V = properMotionMaxError(gmag, vminiM6V)
    sigmuM6Vmax = np.sqrt(0.5 * sigmualphaM6V**2 + 0.5 * sigmudeltaM6V**2)

    fig = plt.figure(figsize=(10, 6.5))

    if (args['gmagAbscissa']):
        plt.semilogy(gmag, sigmuB1V, 'b', label='B1V')
        plt.semilogy(gmag, sigmuG2V, 'g', label='G2V')
        plt.semilogy(gmag, sigmuM6V, 'r', label='M6V')
        plt.xlim((5, 20))
        plt.ylim((1, 500))
        plt.legend(loc=4)
    else:
        ax = fig.add_subplot(111)
        plt.semilogy(vmagB1V, sigmuB1V, 'b', label='B1V')
        #plt.semilogy(vmagG2V, sigmuG2V, 'g', label='G2V')
        plt.semilogy(vmagM6V, sigmuM6V, 'r', label='M6V')
        plt.fill_between(vmagB1V,
                         sigmuB1Vmin,
                         sigmuB1Vmax,
                         color='b',
                         alpha=0.3)
        plt.fill_between(vmagM6V,
                         sigmuM6Vmin,
                         sigmuM6Vmax,
                         color='r',
                         alpha=0.3)
        plt.xlim((5, 22.5))
        plt.ylim((1, 500))
        plt.text(17.5, 100, 'B1V', color='b')
        plt.text(18, 10, 'M6V', color='r')
        plt.text(7,
                 11,
                 'calibration noise floor',
                 size=12,
                 bbox=dict(
                     boxstyle="round,pad=0.3",
                     ec=(0.0, 0.0, 0.0),
                     fc=(1.0, 1.0, 1.0),
                 ))
        plt.text(14.75,
                 50,
                 'photon noise',
                 rotation=45,
                 size=12,
                 bbox=dict(
                     boxstyle="round,pad=0.3",
                     ec=(0.0, 0.0, 0.0),
                     fc=(1.0, 1.0, 1.0),
                 ))
        ax.annotate(
            'non-uniformity\nover the sky',
            xy=(21.5, 80),
            xycoords='data',
            xytext=(21.5, 30),
            textcoords='data',
            ha='center',
            size='12',
            bbox=dict(boxstyle="round,pad=0.3", ec=(0, 0, 0), fc=(1, 1, 1)),
            arrowprops=dict(facecolor='black',
                            shrink=0.15,
                            width=1,
                            headwidth=6),
            horizontalalignment='right',
            verticalalignment='top',
        )
        ax.annotate(
            '',
            xy=(21.5, 170),
            xycoords='data',
            xytext=(21.5, 380),
            textcoords='data',
            ha='center',
            size='12',
            arrowprops=dict(facecolor='black',
                            shrink=0.15,
                            width=1,
                            headwidth=6),
            horizontalalignment='right',
            verticalalignment='bottom',
        )

    plt.xticks(np.arange(6, 24, 2))
    ax = plt.gca().yaxis
    ax.set_major_formatter(matplotlib.ticker.ScalarFormatter())
    plt.ticklabel_format(axis='y', style='plain')
    plt.grid(which='both')
    plt.xlabel('$V$ [mag]')
    plt.ylabel('End-of-mission $\\sigma_\\mu$ [$\mu$as/yr]')

    basename = 'ProperMotionErrors'
    if (args['pdfOutput']):
        plt.savefig(basename + '.pdf')
    elif (args['pngOutput']):
        plt.savefig(basename + '.png')
    else:
        plt.show()
def makePlot(args):
  """
  Make the plot with parallax performance predictions.

  :argument args: command line arguments
  """
  gmag=np.linspace(5.7,20.0,101)

  vminiB1V=vminiFromSpt('B1V')
  vminiG2V=vminiFromSpt('G2V')
  vminiM6V=vminiFromSpt('M6V')
  
  vmagB1V=gmag-gminvFromVmini(vminiB1V)
  vmagG2V=gmag-gminvFromVmini(vminiG2V)
  vmagM6V=gmag-gminvFromVmini(vminiM6V)
  
  sigparB1V=parallaxErrorSkyAvg(gmag,vminiB1V)
  sigparB1Vmin=parallaxMinError(gmag,vminiB1V)
  sigparB1Vmax=parallaxMaxError(gmag,vminiB1V)
  
  sigparG2V=parallaxErrorSkyAvg(gmag,vminiG2V)
  sigparG2Vmin=parallaxMinError(gmag,vminiG2V)
  sigparG2Vmax=parallaxMaxError(gmag,vminiG2V)
  
  sigparM6V=parallaxErrorSkyAvg(gmag,vminiM6V)
  sigparM6Vmin=parallaxMinError(gmag,vminiM6V)
  sigparM6Vmax=parallaxMaxError(gmag,vminiM6V)
  
  fig=plt.figure(figsize=(10,6.5))
  
  if (args['gmagAbscissa']):
    plt.semilogy(gmag, sigparB1V, 'b', label='B1V')
    plt.semilogy(gmag, sigparG2V, 'g', label='G2V')
    plt.semilogy(gmag, sigparM6V, 'r', label='M6V')
    plt.xlim((5,20))
    plt.ylim((4,1000))
    plt.legend(loc=4)
    plt.xlabel('$G$ [mag]')
  else:
    ax=fig.add_subplot(111)
    plt.semilogy(vmagB1V, sigparB1V, 'b', label='B1V')
    #plt.semilogy(vmagG2V, sigparG2V, 'g', label='G2V')
    plt.semilogy(vmagM6V, sigparM6V, 'r', label='M6V')
    plt.fill_between(vmagB1V, sigparB1Vmin, sigparB1Vmax, color='b', alpha=0.3)
    plt.fill_between(vmagM6V, sigparM6Vmin, sigparM6Vmax, color='r', alpha=0.3)
    plt.xlim((5,22.5))
    plt.ylim((4,1000))
    plt.text(17.2,190,'B1V',color='b')
    plt.text(18,20,'M6V',color='r')
    plt.xlabel('$V$ [mag]')
    plt.text(7,17,'calibration noise floor', size=12, bbox=dict(boxstyle="round,pad=0.3",
                       ec=(0.0, 0.0, 0.0),
                       fc=(1.0, 1.0, 1.0),
                       ))
    plt.text(14.75,80,'photon noise', rotation=45, size=12, bbox=dict(boxstyle="round,pad=0.3",
                       ec=(0.0, 0.0, 0.0),
                       fc=(1.0, 1.0, 1.0),
                       ))
    ax.annotate('non-uniformity\nover the sky', xy=(21.5, 320),  xycoords='data',
                  xytext=(21.5,80), textcoords='data', ha='center', size='12',
                  bbox=dict(boxstyle="round,pad=0.3",ec=(0,0,0),fc=(1,1,1)),
                  arrowprops=dict(facecolor='black', shrink=0.15, width=1,
                    headwidth=6),
                  horizontalalignment='right', verticalalignment='top',
                  )
    ax.annotate('', xy=(21.5, 500),  xycoords='data',
                  xytext=(21.5,950), textcoords='data', ha='center', size='12',
                  arrowprops=dict(facecolor='black', shrink=0.15, width=1,
                    headwidth=6),
                  horizontalalignment='right', verticalalignment='bottom',
                  )
  
  plt.xticks(np.arange(6,24,2))
  ax = plt.gca().yaxis 
  ax.set_major_formatter(matplotlib.ticker.ScalarFormatter())
  plt.ticklabel_format(axis='y',style='plain')
  plt.grid(which='both')
  plt.ylabel('End-of-mission parallax standard error [$\mu$as]')
  
  if (args['pdfOutput']):
    plt.savefig('ParallaxErrors.pdf')
  elif (args['pngOutput']):
    plt.savefig('ParallaxErrors.png')
  else:
    plt.show()
Esempio n. 8
0
def makePlot(args):
  """
  Make the plot with parallax horizons. The plot shows V-band magnitude vs distance for a number of
  spectral types and over the range 5.7<G<20. In addition a set of crudely drawn contours show the points
  where 0.1, 1, and 10 per cent relative parallax accracy are reached.

  Parameters
  ----------
  
  args - Command line arguments.
  """
  distances = 10.0**np.linspace(1,6,10001)

  spts=['B0V', 'A0V', 'F0V', 'G0V', 'K0V', 'K4V', 'K1III']
  twokmsRV = []
  twokmsV = []
  vabsTwokms = []
  fivekmsRV = []
  fivekmsV = []
  vabsFivekms = []
  tenkmsRV = []
  tenkmsV = []
  vabsTenkms = []

  fig=plt.figure(figsize=(11,7.8))
  deltaHue = 240.0/(len(spts)-1)
  hues = (240.0-np.arange(len(spts))*deltaHue)/360.0
  hsv=np.zeros((1,1,3))
  hsv[0,0,1]=1.0
  hsv[0,0,2]=0.9
  for hue,spt in zip(hues, spts):
    hsv[0,0,0]=hue
    vmags = vabsFromSpt(spt)+5.0*np.log10(distances)-5.0
    vmini=vminiFromSpt(spt)
    grvsmags = vmags - vminGrvsFromVmini(vmini)
    rvError = vradErrorSkyAvg(vmags, spt)
    observed = (grvsmags>=5.7) & (grvsmags<=16.1)
    rvError = rvError[observed]
    # Identify the points where the relative parallax accuracy is 0.1, 1, or 10 per cent.
    if (rvError.min()<=2.0):
      index = len(rvError[rvError<=2.0])-1
      twokmsRV.append(distances[observed][index])
      twokmsV.append(vmags[observed][index])
      vabsTwokms.append(vabsFromSpt(spt))
    if (rvError.min()<=5.0):
      index = len(rvError[rvError<=5.0])-1
      fivekmsRV.append(distances[observed][index])
      fivekmsV.append(vmags[observed][index])
      vabsFivekms.append(vabsFromSpt(spt))
    if (rvError.min()<=10.0):
      index = len(rvError[rvError<=10.0])-1
      tenkmsRV.append(distances[observed][index])
      tenkmsV.append(vmags[observed][index])
      vabsTenkms.append(vabsFromSpt(spt))
    plt.semilogx(distances[observed], vmags[observed], '-', label=spt, color=hsv_to_rgb(hsv)[0,0,:])
    plt.text(distances[observed][-1], vmags[observed][-1], spt, horizontalalignment='center',
        verticalalignment='bottom', fontsize=14)

  # Draw the "contours" of constant radial velocity accuracy.
  twokmsRV = np.array(twokmsRV)
  twokmsV = np.array(twokmsV)
  indices = np.argsort(vabsTwokms)
  plt.semilogx(twokmsRV[indices],twokmsV[indices],'k--')
  plt.text(twokmsRV[indices][-1]*0.8,twokmsV[indices][-1],"$2$ km s$^{-1}$", ha='right', size=16,
      bbox=dict(boxstyle="round, pad=0.3", ec=(0.0, 0.0, 0.0), fc=(1.0, 1.0, 1.0),))

  fivekmsRV = np.array(fivekmsRV)
  fivekmsV = np.array(fivekmsV)
  indices = np.argsort(vabsFivekms)
  plt.semilogx(fivekmsRV[indices],fivekmsV[indices],'k--')
  plt.text(fivekmsRV[indices][-1]*0.8,fivekmsV[indices][-1],"$5$ km s$^{-1}$", ha='right', size=16,
      bbox=dict(boxstyle="round, pad=0.3", ec=(0.0, 0.0, 0.0), fc=(1.0, 1.0, 1.0),))

  tenkmsRV = np.array(tenkmsRV)
  tenkmsV = np.array(tenkmsV)
  indices = np.argsort(vabsTenkms)
  plt.semilogx(tenkmsRV[indices],tenkmsV[indices],'k--')
  plt.text(tenkmsRV[indices][-1]*0.8,tenkmsV[indices][-1]+0.5,"$10$ km s$^{-1}$", ha='right', size=16,
      bbox=dict(boxstyle="round, pad=0.3", ec=(0.0, 0.0, 0.0), fc=(1.0, 1.0, 1.0),))

  plt.title('Radial velocity accuracy horizons ($A_V=0$)')

  plt.xlabel('Distance [pc]')
  plt.ylabel('V')
  plt.grid()
  #leg=plt.legend(loc=4, fontsize=14, labelspacing=0.5)
  plt.ylim(5,20)
  
  basename='RadialVelocityHorizons'
  if (args['pdfOutput']):
    plt.savefig(basename+'.pdf')
  elif (args['pngOutput']):
    plt.savefig(basename+'.png')
  else:
    plt.show()
def makePlot(args):
    """
  Make the plot with parallax horizons. The plot shows V-band magnitude vs distance for a number of
  spectral types and over the range 5.7<G<20. In addition a set of crudely drawn contours show the points
  where 0.1, 1, and 10 per cent relative parallax accracy are reached.

  Parameters
  ----------
  
  args - Command line arguments.
  """
    distances = 10.0**np.linspace(1, 6, 10001)

    spts = ['B0V', 'A0V', 'F0V', 'G0V', 'K0V', 'K4V', 'K1III']
    twokmsRV = []
    twokmsV = []
    vabsTwokms = []
    fivekmsRV = []
    fivekmsV = []
    vabsFivekms = []
    tenkmsRV = []
    tenkmsV = []
    vabsTenkms = []

    fig = plt.figure(figsize=(11, 7.8))
    deltaHue = 240.0 / (len(spts) - 1)
    hues = (240.0 - np.arange(len(spts)) * deltaHue) / 360.0
    hsv = np.zeros((1, 1, 3))
    hsv[0, 0, 1] = 1.0
    hsv[0, 0, 2] = 0.9
    for hue, spt in zip(hues, spts):
        hsv[0, 0, 0] = hue
        vmags = vabsFromSpt(spt) + 5.0 * np.log10(distances) - 5.0
        vmini = vminiFromSpt(spt)
        grvsmags = vmags - vminGrvsFromVmini(vmini)
        rvError = vradErrorSkyAvg(vmags, spt)
        observed = (grvsmags >= 5.7) & (grvsmags <= 16.1)
        rvError = rvError[observed]
        # Identify the points where the relative parallax accuracy is 0.1, 1, or 10 per cent.
        if (rvError.min() <= 2.0):
            index = len(rvError[rvError <= 2.0]) - 1
            twokmsRV.append(distances[observed][index])
            twokmsV.append(vmags[observed][index])
            vabsTwokms.append(vabsFromSpt(spt))
        if (rvError.min() <= 5.0):
            index = len(rvError[rvError <= 5.0]) - 1
            fivekmsRV.append(distances[observed][index])
            fivekmsV.append(vmags[observed][index])
            vabsFivekms.append(vabsFromSpt(spt))
        if (rvError.min() <= 10.0):
            index = len(rvError[rvError <= 10.0]) - 1
            tenkmsRV.append(distances[observed][index])
            tenkmsV.append(vmags[observed][index])
            vabsTenkms.append(vabsFromSpt(spt))
        plt.semilogx(distances[observed],
                     vmags[observed],
                     '-',
                     label=spt,
                     color=hsv_to_rgb(hsv)[0, 0, :])
        plt.text(distances[observed][-1],
                 vmags[observed][-1],
                 spt,
                 horizontalalignment='center',
                 verticalalignment='bottom',
                 fontsize=14)

    # Draw the "contours" of constant radial velocity accuracy.
    twokmsRV = np.array(twokmsRV)
    twokmsV = np.array(twokmsV)
    indices = np.argsort(vabsTwokms)
    plt.semilogx(twokmsRV[indices], twokmsV[indices], 'k--')
    plt.text(twokmsRV[indices][-1] * 0.8,
             twokmsV[indices][-1],
             "$2$ km s$^{-1}$",
             ha='right',
             size=16,
             bbox=dict(
                 boxstyle="round, pad=0.3",
                 ec=(0.0, 0.0, 0.0),
                 fc=(1.0, 1.0, 1.0),
             ))

    fivekmsRV = np.array(fivekmsRV)
    fivekmsV = np.array(fivekmsV)
    indices = np.argsort(vabsFivekms)
    plt.semilogx(fivekmsRV[indices], fivekmsV[indices], 'k--')
    plt.text(fivekmsRV[indices][-1] * 0.8,
             fivekmsV[indices][-1],
             "$5$ km s$^{-1}$",
             ha='right',
             size=16,
             bbox=dict(
                 boxstyle="round, pad=0.3",
                 ec=(0.0, 0.0, 0.0),
                 fc=(1.0, 1.0, 1.0),
             ))

    tenkmsRV = np.array(tenkmsRV)
    tenkmsV = np.array(tenkmsV)
    indices = np.argsort(vabsTenkms)
    plt.semilogx(tenkmsRV[indices], tenkmsV[indices], 'k--')
    plt.text(tenkmsRV[indices][-1] * 0.8,
             tenkmsV[indices][-1] + 0.5,
             "$10$ km s$^{-1}$",
             ha='right',
             size=16,
             bbox=dict(
                 boxstyle="round, pad=0.3",
                 ec=(0.0, 0.0, 0.0),
                 fc=(1.0, 1.0, 1.0),
             ))

    plt.title('Radial velocity accuracy horizons ($A_V=0$)')

    plt.xlabel('Distance [pc]')
    plt.ylabel('V')
    plt.grid()
    #leg=plt.legend(loc=4, fontsize=14, labelspacing=0.5)
    plt.ylim(5, 20)

    basename = 'RadialVelocityHorizons'
    if (args['pdfOutput']):
        plt.savefig(basename + '.pdf')
    elif (args['pngOutput']):
        plt.savefig(basename + '.png')
    else:
        plt.show()
Esempio n. 10
0
def makePlot(args):
    """
  Make the plot with parallax horizons. The plot shows V-band magnitude vs distance for a number of
  spectral types and over the range 5.7<G<20. In addition a set of crudely drawn contours show the points
  where 0.1, 1, and 10 per cent relative parallax accracy are reached.

  Parameters
  ----------
  
  args - Command line arguments.
  """
    distances = 10.0**np.linspace(1, 6, 10001)
    av = args['extinction']
    ai = 0.479 * av  #Cardelli et al R=3.1

    spts = ['B0I', 'B1V', 'G2V', 'K4V', 'M0V', 'M6V', 'K1III', 'M0III']
    pointOnePercD = []
    pointOnePercV = []
    onePercD = []
    onePercV = []
    tenPercD = []
    tenPercV = []
    vabsPointOnePerc = []
    vabsOnePerc = []
    vabsTenPerc = []

    fig = plt.figure(figsize=(11, 7.8))
    deltaHue = 240.0 / (len(spts) - 1)
    hues = (240.0 - np.arange(len(spts)) * deltaHue) / 360.0
    hsv = np.zeros((1, 1, 3))
    hsv[0, 0, 1] = 1.0
    hsv[0, 0, 2] = 0.9
    for hue, spt in zip(hues, spts):
        hsv[0, 0, 0] = hue
        vmags = vabsFromSpt(spt) + 5.0 * np.log10(distances) - 5.0 + av
        vmini = vminiFromSpt(spt) + av - ai
        #gmags = gabsFromSpt(spt)+5.0*np.log10(distances)-5.0
        gmags = vmags + gminvFromVmini(vmini)
        relParErr = parallaxErrorSkyAvg(gmags, vmini) * distances / 1.0e6
        observed = (gmags >= 5.7) & (gmags <= 20.0)
        relParErrObs = relParErr[observed]
        # Identify the points where the relative parallax accuracy is 0.1, 1, or 10 per cent.
        if (relParErrObs.min() < 0.001):
            index = len(relParErrObs[relParErrObs <= 0.001]) - 1
            pointOnePercD.append(distances[observed][index])
            pointOnePercV.append(vmags[observed][index])
            vabsPointOnePerc.append(vabsFromSpt(spt))
        if (relParErrObs.min() < 0.01):
            index = len(relParErrObs[relParErrObs <= 0.01]) - 1
            onePercD.append(distances[observed][index])
            onePercV.append(vmags[observed][index])
            vabsOnePerc.append(vabsFromSpt(spt))
        if (relParErrObs.min() < 0.1):
            index = len(relParErrObs[relParErrObs <= 0.1]) - 1
            tenPercD.append(distances[observed][index])
            tenPercV.append(vmags[observed][index])
            vabsTenPerc.append(vabsFromSpt(spt))
        plt.semilogx(distances[observed],
                     vmags[observed],
                     '-',
                     label=spt,
                     color=hsv_to_rgb(hsv)[0, 0, :])
        if (spt == 'B0I'):
            plt.text(distances[observed][-1] - 1.0e5,
                     vmags[observed][-1],
                     spt,
                     horizontalalignment='right',
                     verticalalignment='bottom',
                     fontsize=14)
        else:
            plt.text(distances[observed][-1],
                     vmags[observed][-1],
                     spt,
                     horizontalalignment='center',
                     verticalalignment='bottom',
                     fontsize=14)

    # Draw the "contours" of constant relative parallax accuracy.
    pointOnePercD = np.array(pointOnePercD)
    pointOnePercV = np.array(pointOnePercV)
    indices = np.argsort(vabsPointOnePerc)
    plt.semilogx(pointOnePercD[indices], pointOnePercV[indices], 'k--')
    plt.text(pointOnePercD[indices][-1] * 1.2,
             pointOnePercV[indices][-1] - 2.5,
             "$0.1$\\%",
             ha='right',
             size=16,
             bbox=dict(
                 boxstyle="round, pad=0.3",
                 ec=(0.0, 0.0, 0.0),
                 fc=(1.0, 1.0, 1.0),
             ))

    onePercD = np.array(onePercD)
    onePercV = np.array(onePercV)
    indices = np.argsort(vabsOnePerc)
    plt.semilogx(onePercD[indices], onePercV[indices], 'k--')
    plt.text(onePercD[indices][-1] * 1.2,
             onePercV[indices][-1] - 2.5,
             "$1$\\%",
             ha='right',
             size=16,
             bbox=dict(
                 boxstyle="round, pad=0.3",
                 ec=(0.0, 0.0, 0.0),
                 fc=(1.0, 1.0, 1.0),
             ))

    tenPercD = np.array(tenPercD)
    tenPercV = np.array(tenPercV)
    indices = np.argsort(vabsTenPerc)
    plt.semilogx(tenPercD[indices], tenPercV[indices], 'k--')
    plt.text(tenPercD[indices][-1] * 1.5,
             tenPercV[indices][-1] - 2.5,
             "$10$\\%",
             ha='right',
             size=16,
             bbox=dict(
                 boxstyle="round, pad=0.3",
                 ec=(0.0, 0.0, 0.0),
                 fc=(1.0, 1.0, 1.0),
             ))

    plt.title('Parallax relative accuracy horizons ($A_V={0}$)'.format(av))

    plt.xlabel('Distance [pc]')
    plt.ylabel('V')
    plt.grid()
    #leg=plt.legend(loc=4, fontsize=14, labelspacing=0.5)
    plt.ylim(5, 26)

    basename = 'ParallaxHorizons'
    if (args['pdfOutput']):
        plt.savefig(basename + '.pdf')
    elif (args['pngOutput']):
        plt.savefig(basename + '.png')
    else:
        plt.show()