IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39204


Ignore:
Timestamp:
Dec 1, 2015, 7:15:51 AM (11 years ago)
Author:
eugene
Message:

add monte-carlo distance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20151113/Ohana/src/uniphot/doc/galmotion.sh

    r39203 r39204  
    3535# generate the predicted proper motions
    3636
     37macro mkstars_dmerr
     38  if ($0 != 5)
     39    echo "USAGE: mkstars (Nstars) (Dm) (Dm_err) (Nsample)"
     40    break
     41  end
     42
     43  create seq 0 $1
     44  set phi   = 2*rnd(seq) - 1
     45
     46  set d_kpc = ten(0.2*$2 - 2)
     47
     48  set L = 360*rnd(seq)
     49  set B = dasin(phi)
     50
     51  set R = L
     52  set D = B
     53  csystem G C R D
     54
     55  set uL_gal =     ($A_oort * dcos(2.0*L) + $B_oort) * dcos(B*1.0) * $iFkap;
     56  set uB_gal = -0.5*$A_oort * dsin(2.0*L) *            dsin(B*2.0) * $iFkap;
     57
     58  set uL_sol =  ($U_sol * dsin(L) - $V_sol * dcos(L))                           * $iFkap / $d_kpc;
     59  set uB_sol = (($U_sol * dcos(L) + $V_sol * dsin(L))*dsin(B) - $W_sol*dcos(B)) * $iFkap / $d_kpc;
     60
     61  set uL_o = uL_gal + uL_sol
     62  set uB_o = uB_gal + uB_sol
     63
     64  set uL_sol_o = uL_sol
     65  set uB_sol_o = uB_sol
     66
     67  # create a buffer to store the results : results for each star are in the y-dir,
     68  mcreate resultsL $1 $4
     69  mcreate resultsB $1 $4
     70
     71  # now MC a number of distances
     72  for i 0 $4
     73    echo $i
     74    gaussdev Dm_x $1 $2 $3
     75    set d_kpc = ten(0.2*Dm_x - 2)
     76   
     77    set uL_sol =  ($U_sol * dsin(L) - $V_sol * dcos(L))                           * $iFkap / d_kpc;
     78    set uB_sol = (($U_sol * dcos(L) + $V_sol * dsin(L))*dsin(B) - $W_sol*dcos(B)) * $iFkap / d_kpc;
     79
     80    set duL = uL_sol - uL_sol_o
     81    set duB = uB_sol - uB_sol_o
     82
     83    mset resultsL duL -x $i   
     84    mset resultsB duB -x $i   
     85  end
     86   
     87  set duL = zero(uL_o)
     88  set duB = zero(uB_o)
     89  set uLoff = zero(uL_o)
     90  set uBoff = zero(uB_o)
     91
     92  for i 0 $1
     93    mget resultsL tmp -y $i
     94    vstat -q tmp
     95   
     96    uLoff[$i] = $MEAN
     97    duL[$i] = $SIGMA
     98
     99    mget resultsB tmp -y $i
     100    vstat -q tmp
     101   
     102    uBoff[$i] = $MEAN
     103    duB[$i] = $SIGMA 
     104  end
     105end
     106
    37107macro mkstars
    38   if ($0 != 4)
    39     echo "USAGE: mkstars (Nstars) (d kpc) (scale)"
     108  if ($0 != 3)
     109    echo "USAGE: mkstars (Nstars) (d kpc)"
    40110    break
    41111  end
     
    46116  set L = 360*rnd(seq)
    47117  set B = dasin(phi)
    48 
    49   resize -n galactic 1600 800
    50   region 0 0 90 ait; cgrid -c red
    51 
    52   resize -n celestial 1600 800
    53   region 0 0 90 ait; cgrid -c red
    54118
    55119  set R = L
     
    66130  set uB = uB_gal + uB_sol
    67131
    68   dev -n galactic
    69   cneedles L B uL uB -scale $3 -c black -lw 0
    70   cplot L B -pt 0 -sz 0.3 -c black
    71   label +x Galactic -fn courier 24
    72 
    73132  # C1, C2 are from http://arxiv.org/pdf/1306.2945v2.pdf
    74133  set C1 =  dcos(D)*$trans_cos_phi + dsin(D)*(dcos(R)*$trans_sin_phi_sin_Xo - dsin(R)*$trans_sin_phi_cos_Xo);
     
    79138  set uR = cosBinv * (C1 * uL - C2 * uB);
    80139  set uD = cosBinv * (C1 * uB + C2 * uL);
     140end
    81141
    82   dev -n celestial
     142macro pltstars
     143  if ($0 != 2)
     144    echo "USAGE: pltstars (scale)"
     145    break
     146  end
     147
     148  resize -n galactic 1600 800
     149  region 0 0 90 ait; cgrid -c red
     150
     151  cneedles L B uL uB -scale $1 -c black -lw 0
     152  cplot L B -pt 0 -sz 0.3 -c black
     153  label +x Galactic -fn courier 24
     154
     155  resize -n celestial 1600 800
     156  region 0 0 90 ait; cgrid -c red
     157
    83158  style -c red -lw 0 -pt 0 -sz 0.3; cggrid; style -c blue; galactic
    84159  cplot R D -pt 0 -sz 0.3 -c black
    85   cneedles R D uR uD -scale $3 -c black -lw 0
     160  cneedles R D uR uD -scale $1 -c black -lw 0
    86161  label +x Celestial -fn courier 24
    87 
    88  
    89162end
    90163
Note: See TracChangeset for help on using the changeset viewer.