Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1488 |
|
include "measures.g"
A measure is a quantity with a specified reference frame (e.g. UTC, J2000, mars). The measures module provides an interface to the handling of measures. The basic functionality provided is:
To access the measures module, include the measures.g Glish script. This will create a default Measures tool called dm.
Altough a Measures tool has state (it remembers the frame you are working in), there is only in very special cases the need to create your own tool . Just use the default dm one. However, if you do require one, perhaps to distinguish working in two different environment frames for an input observation and and output display, then use the measures constructor to make one:
- include 'measures.g'; - mydm := measures(); # measures tool created for you - mydm.type(); measures
In normal use, the measures tool will be operated using a GUI. All operations can be done from either the command line or the GUI. The aipsrc mechanism is used by the measures tool to specify certain operational details (like using DE405 rather than the default DE200 for planetary positions).
Measures
Measures are e.g. an epoch, or coordinates, which have, in addition to values (as quantities), also a reference specification, and possibly an offset. They are represented as records with fields describing the various entities embodied in the measure. These entities can be obtained by the access methods gettype, getref, getoffset. getvalue.
Each measure has its own list of reference codes (see the individual methods for creating them, like direction). If an empty or no code reference code is given, the default code for that type of measure will be used (e.g. it is J2000 for a direction). If an unknown code is given, this default is also returned, but with a warning message.
The values of a measure (like the right-ascension for a direction) are given as quantities. Each of them can be either a scalar quantity with a scalar or vector for its actual value (see the following example). The values can also be given as an r_array, in which case each element of that array will be used as a value. E.g a vector of length 2 of quanta will be seen in a direction constructor as a longitude and a latitude.
- dm.epoch('utc','today') # note that your value will be different [type=epoch, refer=UTC, m0=[value=51350.0778, unit=d]] - dm.direction('j2000','5h20m','-30.2deg') [type=direction, refer=J2000, m1=[value=-0.527089434, unit=rad], m0=[unit=rad, value=1.3962634]] - a := dm.direction('j2000','5h20m','-30.2deg') - dm.gettype(a) direction - dm.getoffset(a) F - dm.getref(a) J2000 - dm.getvalue(a) [*53=[unit=rad, value=1.3962634], *54=[value=-0.527089434, unit=rad]] - dm.getvalue(a)[1] [unit=rad, value=1.3962634] - dm.getvalue(a)[2] [value=-0.527089434, unit=rad] - # try as a scalar quantity with multiple values - a := dm.direction('j2000', dq.quantity([10,20],'deg'), + dq.quantity([30,40], 'deg')) - dm.getvalue(a)[1] [unit=rad, value=[0.174532925 0.34906585] ] - dq.getvalue(dm.getvalue(a)[1])[2] 0.34906585 - a [type=direction, refer=J2000, m1=[value=[0.523598776 0.698131701] , unit=rad], m0=[unit=rad, value=[0.174532925 0.34906585] ]] - # try as an r_array - b := r_array(,2) - r_fill(dq.quantity([10,20],'deg'), b, 1) T - r_fill(dq.quantity([30,40],'deg'), b, 2) T - a := dm.direction('j2000', b) - dm.getvalue(a) [*61=[unit=rad, value=[0.174532925 0.34906585] ], *62=[value=[0.523598776 0.698131701] , unit=rad]]
Known measures are:
In addition to the reference code (like J2000), a measure needs sometimes more information to be convertable to another reference code (e.g. a time and position to convert it to an azimuth/elevation). This additional information is called the reference frame, and can specify one or more of 'where am i', 'when is it', 'what direction", 'how fast'.
The frame values can be set by the doframe tool function, or by a menu on the measure guis.
Since you would normally work from a fixed position, the position frame element ('where you are'), can be specified in your .aipsrc if its name is in the Observatory list (obslist) tool function. You can set your preferred position by adding to your .aipsrc file:
measures.default.observatory: atca
More information on the individual measures can be found in the GUI descriptions for epoch; direction; position; frequency; radialvelocity; doppler.
- include 'measures.g' # 1 T - tim := dm.epoch('utc','today') # 2 - tim [type=epoch, refer=UTC, m0=[value=51350.0934, unit=d]] - pos := dm.observatory('ATCA') # 3 - dm.doframe(tim) # 4 T - dm.doframe(pos) # 5 T - coord := dm.direction('J2000', '5h20m30.2', '-30d15m12.5') # 6 - hadec := dm.measure(coord,'hadec') # 7 - last := dm.measure(tim,'last') # 8 - sdec := dq.sin(dm.getvalue(hadec)[2]) # 9 - cdec := dq.cos(dm.getvalue(hadec)[2]) - clat := dq.cos(dm.getvalue(pos)[2]) - slat := dq.sin(dm.getvalue(pos)[2]) - ha := dq.acos(dq.neg(dq.div(dq.mul(sdec, slat), dq.mul(cdec, clat)))) #10 - dq.norm(dq.add(ha, dm.getvalue(coord)[1]), 0) #11 [value=189.926855, unit=deg] - dq.time(dq.norm(dq.add(ha, dm.getvalue(coord)[1]), 0)) #12 12:39:42.445 - rt := dq.totime(dq.norm(dq.add(ha, dm.getvalue(coord)[1]))) #13 - rt [value=-0.472425402, unit=d] - rtoff := dm.epoch('r_utc', dm.getvalue(tim)[1]) #14 - rtoff [type=epoch, refer=R_UTC, m0=[value=51350, unit=d]] - rte := dm.epoch('last', rt, off=rtoff) #15 - rte [type=epoch, refer=LAST, m0=[value=58062.5276, unit=d]] - dm.measure(rte, 'utc') #16 [type=epoch, refer=UTC, m0=[value=51349.3674, unit=d]] - dq.time(dm.getvalue(dm.measure(rte, 'utc'))[1], form="ymd time") 1999/06/20/08:48:59.738 - dq.time(dm.getvalue(dm.measure(dm.measure(rte, 'utc'), 'last'))[1]) #17 12:39:42.445 - # try it another way - tim := dm.epoch('utc', 'today') #18 - tim := dm.measure(tim,'tai') #19 - dm.doframe(tim) #20 T - dm.showframe(F) #21 position: 09:58:12.033 -030.08.43.736 6372960.26 m ITRF epoch: 2002/10/18/00:15:49 UTC T - is_measure(tim) #22 T - sun:=dm.direction('sun') #23 - dm.rise(sun) #24 [rise=[value=20.4413559, unit=deg], set=[value=158.042775, unit=deg]] - dm.rise(sun,'10deg') #25 [rise=[value=27.3170864, unit=deg], set=[value=151.167045, unit=deg]] - dq.form.long(dm.rise(sun).rise) #26 01:21:45.925 - dq.setformat('long','dms') #27 T - dq.form.long(dm.rise(sun).rise) +020.26.28.881
dm.doframe(dm.observatory('atca'))will solve it.
The above could be done using the GUI (start it with dm.gui()), setting your position in the Frame menu option, and using the rise/set application. Another option would be to use the direction GUI (from the Tool menu in the general GUI or starting dm.directiongui() from the command line); selecting the Sun as planet; setting the position in the frame menu and the time; Convert to J2000, and select rise/set from the Info menu.
If at one stage you want to use a GUI result on the command line, the 'copy' button will transfer the last result to the clipboard (and read it with the normal clipboard operation
- dcb.paste() [type=direction, refer=J2000, m1=[value=0.669116295, unit=rad], m0=[unit=rad, value=0.0259745717]]
measures | measures tool |
measuresgui | gui code for measures.g |
Functions
is_measure | Check if measure |