Planet: Difference between revisions

From CASA Guides
Jump to navigationJump to search
Thunter (talk | contribs)
Thunter (talk | contribs)
 
(39 intermediate revisions by the same user not shown)
Line 3: Line 3:
This page documents the '''planet''' function of Python module [[Analysis Utilities|analysisUtils]].
This page documents the '''planet''' function of Python module [[Analysis Utilities|analysisUtils]].


This function contacts the [http://ssd.jpl.nasa.gov/horizons.cgi#top JPL Horizons] telnet server to get the J2000 position, rate, and angular size of any Solar System body.  
This function returns the position (J2000 or apparent) and angular size of any Solar System body for the specified date from the specified observatory (or geocentric).  By default, it contacts the [http://ssd.jpl.nasa.gov/horizons.cgi#top JPL Horizons] telnet server to get apparent angular size, position and rate of any Solar System body. If the date and time is not specified, and no measurement set is provided, then today's date is assumed at 0:00 UT.  If the time is not specified, 0:00 UT is assumed.  If the observatory is not specified, ALMA is assumed. In case an internet connection is not available, there is an option to instead query the casa ephemerides (useJPL=False).  However, the reported values will be less accurate due to the need to interpolate from a coarser grid.  Also, using the casa ephemerides presently (casa <= 3.4) returns the apparent position but this will be changed to J2000 in casa 4.0.
If the date is not specified, today's date is assumed at 0:00 UT.  If the observatory is not specified, ALMA is assumed.
It returns a dictionary of: {'directionRadians', 'rateRadiansPerSecond', 'angularDiameter'} where each element is a list
of two values: RA, Dec.


==Usage==
au.planet(body="", date="", observatory='ALMA', verbose=False, help=False, mjd=None, beam="", useJPL=True, standard='Butler-JPL-Horizons 2010', apparent=False, vis="", bodyForScan="", scan="",
savefig="", showplot=False, antennalist="",frequency=345.0)
  body: string name of Solar system body
  date: one possible format of the date string is: '2011-10-31 11:59:59'
    or simply '2011-10-31' for 0:00 UT. A list of allowed formats for date
    is at:  http://ssd.jpl.nasa.gov/?horizons_doc#time
    An alternative is to use the vis option, which will read the start time of an ms
  mjd: floating point MJD (alternative to specifying a date string)
  useJPL: if False, first try the casa ephemerides.  Note that the casa tables
    are quantized to one day. If the
    casa tables fail for any reason, it will automatically revert to using
    JPL's server.  It may require a few seconds to reach the JPL server.
  beam:  If a beam size is included (in arcsec), the expected FWHM will be
    computed using scipy.signal.convolve() of a Gaussian with a uniform disk.
  apparent: Boolean value, relevant only if useJPL=True
        False = the return values are J2000 as seen from the specified location
        True = the return values are Apparent as seen from the specified location
  vis: the name of an ms from which to grab the start time of the first scan on the body
      as the date (or simply the start time of the ms if the body is not found)
  bodyForScan: the fieldname in vis to pick the date/time of the first scan
  scan:  if not "", then use this scan number, if it is a scan on the specified body
  savefig: if a filename is given with this parameter, then use antennalist to generate a visibility plot
  showplot: if True, then use antennalist to generate a visibility plot
  antennalist: if an antenna configuration file is given, then use this one,
          otherwise build a temporary one from the specified measurement set
  frequency: the frequency to use in predictcomp (in GHz)
  observatory: Observatories can be specified by JPL ID string, or by the
    following names:<br>
  {|
|-
| 'VLA'  || (which will be converted to = '-5')
|-
| 'ALMA' || (which will be converted to = '-7')
|-
| 'GBT'  || (which will be converted to = '-9')
|-
| 'MAUNAKEA' || (which will be converted to = '-80')
|-
| 'OVRO' || (which will be converted to = '-81')
|-
| 'geocentric' || (which will be converted to = '500')
  |}


==Usage==


Usage: au.planet(solarSystemBody='', date='', observatory='ALMA', verbose=False)<br>
The return values are apparent values as seen from the specified observatory:
The format of the date string is: '2011-10-31 11:59:59' or simply '2011-10-31' for 0 UT<br>
The dictionary returned is:
Observatories can be specified by JPL ID string, JPL ID integer, or by the following names:
  data['directionRadians']
   * 'VLA' (which will be converted to = '-5')
   data['angularDiameter'] (in arc seconds)
   * 'ALMA' (which will be converted to = '-7')
   data['rateRadiansPerSecond'] (only present if useJPL=True)
   * 'MAUNAKEA' (which will be converted to = '-80')
   data['rangeRateKms'] (only present if useJPL=True)
   * 'OVRO' (which will be converted to = '-81')
   data['rangeAU'] (only present if useJPL=True)


==Examples==
==Examples==
<source lang="python">
<source lang="python">
CASA <7>: au.planet('Titan','2012-04-01','EVLA')
CASA <3>: au.planet('Titan','2012-04-01','EVLA')
Using observatory: VLA = -5
Using observatory: VLA = -5
Contacting JPL Horizons for Titan
Assuming 0 hours UT
Assuming 0 hours UT
MJD= 56018.00000, MJDseconds = 4839955200.0
MJD= 56018.00000, MJDseconds = 4839955200.0
LST day = 62742,  LST = 5.4757 hours (at longitude=-107.618334)
Julian day = 2456018.500000, MJD = 56018.000000, MJD seconds = 4839955200.000000
Confirmed Observatory name =  VLA
Confirmed Observatory name =  VLA
Confirmed Target ID = 606 = Titan
Confirmed Target ID = 606 = Titan
Range rate = -12.386017 km/sec
J2000 Position: 13:44:49.19, -007:52:27.645, rate: -11.9723, 3.3884 arcsec/hr
J2000 Position: 13:44:49.19, -007:52:27.645, rate: -11.9723, 3.3884 arcsec/hr
Angular diameter = 0.811703 arcsec
Angular diameter = 0.811703 arcsec
   Out[7]:
   Out[3]:
{'angularDiameter': 0.81170299999999995,
{'angularDiameter': 0.81170299999999995,
  'directionRadians': [3.5989557494879238, -0.13743326065058692],
  'directionRadians': [3.5989557494879238, -0.13743326065058692],
'rangeAU': 8.7480170957841707,
'rangeRateKms': -12.3860165,
  'rateRadiansPerSecond': [-1.6123152317632495e-08, 4.5631673694531841e-09]}
  'rateRadiansPerSecond': [-1.6123152317632495e-08, 4.5631673694531841e-09]}
CASA <4>: au.planet('Moon','2012-04-01 12:55')
Contacting JPL Horizons for Moon
MJD= 56018.53819, MJDseconds = 4840001700.0
LST day = 62742,  LST = 21.0853 hours (at longitude=-67.754929)
Julian day = 2456019.038194, MJD = 56018.538194, MJD seconds = 4840001700.000000
Confirmed Observatory name =  ALMA
Confirmed Target ID = 301 = Moon
Range rate = -0.156855 km/sec
J2000 Position: 08:14:33.97, +015:40:16.537, rate: 2648.9190, -473.5570 arcsec/hr
Angular diameter = 1831.355000 arcsec
  Out[4]:
{'angularDiameter': 1831.355,
'directionRadians': [2.1579522305263157, 0.27351509191740353],
'rangeAU': 0.0026161249308700001,
'rangeRateKms': -0.15685499999999999,
'rateRadiansPerSecond': [3.5673115870860856e-06, -6.3774142329219044e-07]}
CASA <2>: au.planet('Ceres',useJPL=False)
No date/time specified, assuming today=2012-05-08 at UT 0:00
Using casa's ephemerides for Ceres. Note these can be in error by a
few arcminutes.  Set useJPL=True for highest accuracy.
J2000 Position: 02:42:12.97, +010:15:42.228
Angular diameter = 0.342199 arcsec
  Out[2]:
{'angularDiameter': 0.34219936014504132,
'directionRadians': [0.70780169751840638, 0.17910097545067771]}
CASA <2>: au.planet('Neptune',antennalist='alma_cycle1_3',useJPL=False,date='2013-07-19 12:00',frequency='660')
MJD= 56492.50000, MJDseconds= 4880952000.0, JD= 2456493.00000
Using casa's ephemerides for Neptune. These are in J2000 coordinates in this casa version (>=4.0.0)
Figure saved in Neptune.predictcomp.png
Found 496 baselines
Unprojected lengths:  min=21.332979, max=442.672318, rms=131.833021
Percentage of baselines shorter than this angular scale at 660.0 GHz = 3.226
J2000 Position: 22:27:19.28604, -010:24:17.48916  Azim, Elev: -93.125, 19.855
Angular diameter (major axis) = 2.340549 arcsec
Found 496 baselines
Unprojected lengths:  min=21.332979, max=442.672318, rms=131.833021
Percentage of baselines shorter than this angular scale at 660.0 GHz = 3.226
  Out[2]:
{'angularDiameter': 2.3405488492600002,
'directionRadians': [-0.4043865307689844, -0.1815990320460561]}
CASA <2>: au.planet(vis='Band7multi_april22.ms',bodyForScan='Titan')
Got date from the first scan on Titan (scan 4) using msmd
Got date from scan 4: 2011-04-22 00:07:03
Contacting JPL Horizons for Titan
MJD= 55673.00490, MJDseconds= 4810147623.0, JD= 2455673.50490
Recognized observatory = ALMA
LST day = 62396,  LST = 9.5812 hours (at longitude=-67.754748)
Julian day = 2455673.504896, MJD = 55673.004896, MJD seconds = 4810147623.000000
Confirmed Target ID = 606 = Titan
Range rate = +14.473850 km/sec
Azim = 73.913 deg  Elev = 38.520 deg
J2000 Position: 12:49:28.61693, -002:22:20.33796  Azim, Elev: 73.913, 38.520
J2000 Rate: -9.7889, +4.4019 arcsec/hour (position angle = -65.8deg)
J2000 Rate: -0.002719, +0.001223 arcsec/second  (position angle = -65.8deg)
Angular diameter (major axis) = 0.819580 arcsec
  Out[2]:
{'angularDiameter': 0.81957999999999998,
'directionRadians': [3.357476568689957, -0.041404726843071053],
'rangeAU': 8.6644495249590392,
'rangeRateKms': 14.473850300000001,
'rateRadiansPerSecond': [-1.3182770808749855e-08, 5.9280067642847316e-09]}
</source>
</source>

Latest revision as of 20:28, 6 September 2013

Return to Analysis Utilities

This page documents the planet function of Python module analysisUtils.

This function returns the position (J2000 or apparent) and angular size of any Solar System body for the specified date from the specified observatory (or geocentric). By default, it contacts the JPL Horizons telnet server to get apparent angular size, position and rate of any Solar System body. If the date and time is not specified, and no measurement set is provided, then today's date is assumed at 0:00 UT. If the time is not specified, 0:00 UT is assumed. If the observatory is not specified, ALMA is assumed. In case an internet connection is not available, there is an option to instead query the casa ephemerides (useJPL=False). However, the reported values will be less accurate due to the need to interpolate from a coarser grid. Also, using the casa ephemerides presently (casa <= 3.4) returns the apparent position but this will be changed to J2000 in casa 4.0.

Usage

au.planet(body="", date="", observatory='ALMA', verbose=False, help=False, mjd=None, beam="", useJPL=True, standard='Butler-JPL-Horizons 2010', apparent=False, vis="", bodyForScan="", scan="", savefig="", showplot=False, antennalist="",frequency=345.0)

 body: string name of Solar system body
 date: one possible format of the date string is: '2011-10-31 11:59:59'
   or simply '2011-10-31' for 0:00 UT. A list of allowed formats for date
   is at:   http://ssd.jpl.nasa.gov/?horizons_doc#time
   An alternative is to use the vis option, which will read the start time of an ms
 mjd: floating point MJD (alternative to specifying a date string)
 useJPL: if False, first try the casa ephemerides.  Note that the casa tables
   are quantized to one day. If the
   casa tables fail for any reason, it will automatically revert to using
   JPL's server.  It may require a few seconds to reach the JPL server.
 beam:  If a beam size is included (in arcsec), the expected FWHM will be
   computed using scipy.signal.convolve() of a Gaussian with a uniform disk.
 apparent: Boolean value, relevant only if useJPL=True
        False = the return values are J2000 as seen from the specified location
        True = the return values are Apparent as seen from the specified location
 vis: the name of an ms from which to grab the start time of the first scan on the body 
      as the date (or simply the start time of the ms if the body is not found)
 bodyForScan: the fieldname in vis to pick the date/time of the first scan
 scan:  if not "", then use this scan number, if it is a scan on the specified body
 savefig: if a filename is given with this parameter, then use antennalist to generate a visibility plot
 showplot: if True, then use antennalist to generate a visibility plot
 antennalist: if an antenna configuration file is given, then use this one,
         otherwise build a temporary one from the specified measurement set
 frequency: the frequency to use in predictcomp (in GHz)
 observatory: Observatories can be specified by JPL ID string, or by the
   following names:
'VLA' (which will be converted to = '-5')
'ALMA' (which will be converted to = '-7')
'GBT' (which will be converted to = '-9')
'MAUNAKEA' (which will be converted to = '-80')
'OVRO' (which will be converted to = '-81')
'geocentric' (which will be converted to = '500')


The return values are apparent values as seen from the specified observatory: The dictionary returned is:

 data['directionRadians']
 data['angularDiameter'] (in arc seconds)
 data['rateRadiansPerSecond'] (only present if useJPL=True)
 data['rangeRateKms'] (only present if useJPL=True)
 data['rangeAU'] (only present if useJPL=True)

Examples

CASA <3>: au.planet('Titan','2012-04-01','EVLA')
Using observatory: VLA = -5
Contacting JPL Horizons for Titan
Assuming 0 hours UT
MJD= 56018.00000, MJDseconds = 4839955200.0
LST day = 62742,  LST = 5.4757 hours (at longitude=-107.618334)
Julian day = 2456018.500000, MJD = 56018.000000, MJD seconds = 4839955200.000000
Confirmed Observatory name =  VLA
Confirmed Target ID = 606 = Titan
Range rate = -12.386017 km/sec
J2000 Position: 13:44:49.19, -007:52:27.645, rate: -11.9723, 3.3884 arcsec/hr
Angular diameter = 0.811703 arcsec
  Out[3]:
{'angularDiameter': 0.81170299999999995,
 'directionRadians': [3.5989557494879238, -0.13743326065058692],
 'rangeAU': 8.7480170957841707,
 'rangeRateKms': -12.3860165,
 'rateRadiansPerSecond': [-1.6123152317632495e-08, 4.5631673694531841e-09]}

CASA <4>: au.planet('Moon','2012-04-01 12:55')
Contacting JPL Horizons for Moon
MJD= 56018.53819, MJDseconds = 4840001700.0
LST day = 62742,  LST = 21.0853 hours (at longitude=-67.754929)
Julian day = 2456019.038194, MJD = 56018.538194, MJD seconds = 4840001700.000000
Confirmed Observatory name =  ALMA
Confirmed Target ID = 301 = Moon
Range rate = -0.156855 km/sec
J2000 Position: 08:14:33.97, +015:40:16.537, rate: 2648.9190, -473.5570 arcsec/hr
Angular diameter = 1831.355000 arcsec
  Out[4]:
{'angularDiameter': 1831.355,
 'directionRadians': [2.1579522305263157, 0.27351509191740353],
 'rangeAU': 0.0026161249308700001,
 'rangeRateKms': -0.15685499999999999,
 'rateRadiansPerSecond': [3.5673115870860856e-06, -6.3774142329219044e-07]}

CASA <2>: au.planet('Ceres',useJPL=False)
No date/time specified, assuming today=2012-05-08 at UT 0:00
Using casa's ephemerides for Ceres. Note these can be in error by a
few arcminutes.  Set useJPL=True for highest accuracy.
J2000 Position: 02:42:12.97, +010:15:42.228
Angular diameter = 0.342199 arcsec
  Out[2]: 
{'angularDiameter': 0.34219936014504132,
 'directionRadians': [0.70780169751840638, 0.17910097545067771]}

CASA <2>: au.planet('Neptune',antennalist='alma_cycle1_3',useJPL=False,date='2013-07-19 12:00',frequency='660')
MJD= 56492.50000, MJDseconds= 4880952000.0, JD= 2456493.00000
Using casa's ephemerides for Neptune. These are in J2000 coordinates in this casa version (>=4.0.0)
Figure saved in Neptune.predictcomp.png
Found 496 baselines
Unprojected lengths:  min=21.332979, max=442.672318, rms=131.833021
Percentage of baselines shorter than this angular scale at 660.0 GHz = 3.226
J2000 Position: 22:27:19.28604, -010:24:17.48916   Azim, Elev: -93.125, 19.855
Angular diameter (major axis) = 2.340549 arcsec
Found 496 baselines
Unprojected lengths:  min=21.332979, max=442.672318, rms=131.833021
Percentage of baselines shorter than this angular scale at 660.0 GHz = 3.226
  Out[2]:
{'angularDiameter': 2.3405488492600002,
 'directionRadians': [-0.4043865307689844, -0.1815990320460561]}

CASA <2>: au.planet(vis='Band7multi_april22.ms',bodyForScan='Titan')
Got date from the first scan on Titan (scan 4) using msmd
Got date from scan 4: 2011-04-22 00:07:03
Contacting JPL Horizons for Titan
MJD= 55673.00490, MJDseconds= 4810147623.0, JD= 2455673.50490
Recognized observatory = ALMA
LST day = 62396,  LST = 9.5812 hours (at longitude=-67.754748)
Julian day = 2455673.504896, MJD = 55673.004896, MJD seconds = 4810147623.000000
Confirmed Target ID = 606 = Titan
Range rate = +14.473850 km/sec
Azim = 73.913 deg   Elev = 38.520 deg
J2000 Position: 12:49:28.61693, -002:22:20.33796   Azim, Elev: 73.913, 38.520
J2000 Rate: -9.7889, +4.4019 arcsec/hour (position angle = -65.8deg)
J2000 Rate: -0.002719, +0.001223 arcsec/second  (position angle = -65.8deg)
Angular diameter (major axis) = 0.819580 arcsec
  Out[2]:
{'angularDiameter': 0.81957999999999998,
 'directionRadians': [3.357476568689957, -0.041404726843071053],
 'rangeAU': 8.6644495249590392,
 'rangeRateKms': 14.473850300000001,
 'rateRadiansPerSecond': [-1.3182770808749855e-08, 5.9280067642847316e-09]}