miriad 4.1.0.4 → 4.1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +2 -2
- data/ext/miriad_ruby.c +11 -7
- data/ext/miriad_ruby.i +17 -2
- data/ext/miriad_wrap.c +23 -15
- data/lib/miriad.rb +206 -12
- metadata +3 -3
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: Rakefile
|
1
|
+
# $Id: Rakefile 23 2008-04-30 21:42:24Z davidm $
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'rake/gempackagetask'
|
@@ -14,7 +14,7 @@ run_swig unless test ?e, 'ext/miriad_wrap.c'
|
|
14
14
|
spec = Gem::Specification.new do |s|
|
15
15
|
# Basics
|
16
16
|
s.name = 'miriad'
|
17
|
-
s.version = '4.1.0.
|
17
|
+
s.version = '4.1.0.6'
|
18
18
|
s.summary = 'Ruby interface to MIRIAD'
|
19
19
|
s.description = <<-EOS
|
20
20
|
The MIRIAD-Ruby package...
|
data/ext/miriad_ruby.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* $Id: miriad_ruby.c
|
2
|
+
* $Id: miriad_ruby.c 23 2008-04-30 21:42:24Z davidm $
|
3
3
|
*
|
4
4
|
* This file is just to document the classes/methods from the SWIG wrappers
|
5
5
|
* that we want to document. It is for rdoc, not gcc. At least for now.
|
@@ -95,10 +95,12 @@ static VALUE uvio_probvr;
|
|
95
95
|
* +data+. Generally, this works well only for Strings and NArrays, but not
|
96
96
|
* for Numeric types. For full control, specify +type+ as one of...
|
97
97
|
*
|
98
|
-
* * <tt>?a</tt> - ASCII data
|
99
|
-
* * <tt>?i</tt> - Integer data
|
100
|
-
* * <tt>?r</tt> - Single precision real data
|
101
|
-
* * <tt>?d</tt> - Double precision real data
|
98
|
+
* * <tt>'a'</tt> (or <tt>?a</tt>) - ASCII data
|
99
|
+
* * <tt>'i'</tt> (or <tt>?i</tt>) - Integer data
|
100
|
+
* * <tt>'r'</tt> (or <tt>?r</tt>) - Single precision real data
|
101
|
+
* * <tt>'d'</tt> (or <tt>?d</tt>) - Double precision real data
|
102
|
+
* * <tt>'c'</tt> (or <tt>?c</tt>) - Single precision complex data [NOT YET
|
103
|
+
* SUPPORTED!]
|
102
104
|
*/
|
103
105
|
static VALUE uvio_putvr;
|
104
106
|
|
@@ -449,7 +451,8 @@ static VALUE uvio_track;
|
|
449
451
|
*
|
450
452
|
* +object+ can be either <tt>'source'</tt> or <tt>'purpose'</tt>.
|
451
453
|
*
|
452
|
-
* +datasel+ is either 1 to select or 0 to
|
454
|
+
* +datasel+ is either +true+ or <tt>1</tt> to select; +false+ or <tt>0</tt> to
|
455
|
+
* reject.
|
453
456
|
*
|
454
457
|
* +value+ is a String that will be used as the search critereon.
|
455
458
|
*
|
@@ -474,7 +477,8 @@ static VALUE uvio_sela;
|
|
474
477
|
* +object+ is a String giving the parameter on which a select/discard
|
475
478
|
* criterion is based. See the list below for permissible values for +object+.
|
476
479
|
*
|
477
|
-
* +datasel+ is either 1 to select or 0 to
|
480
|
+
* +datasel+ is either +true+ or <tt>1</tt> to select; +false+ or <tt>0</tt> to
|
481
|
+
* reject.
|
478
482
|
*
|
479
483
|
* <tt>p1</tt> and <tt>p2</tt>, both Floats, give added numerical parameters.
|
480
484
|
* Generally <tt>p1</tt> and <tt>p2</tt> give a range of parameter values to
|
data/ext/miriad_ruby.i
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* $Id: miriad_ruby.i
|
2
|
+
* $Id: miriad_ruby.i 23 2008-04-30 21:42:24Z davidm $
|
3
3
|
*
|
4
4
|
* Ruby specific typemaps for MIRIAD Swig wrapper
|
5
5
|
*/
|
@@ -241,7 +241,11 @@ PUTVRX_TYPEMAP(NA_DFLOAT,double,NUM2DBL);
|
|
241
241
|
|
242
242
|
// putvr typemap.
|
243
243
|
%typemap(in) (int type) {
|
244
|
-
|
244
|
+
if(TYPE($input) == T_STRING) {
|
245
|
+
$1 = (int)((RSTRING($input)->ptr)[0]);
|
246
|
+
} else {
|
247
|
+
$1 = NUM2INT($input);
|
248
|
+
}
|
245
249
|
switch($1) {
|
246
250
|
case 'a': $1 = H_BYTE; break;
|
247
251
|
case 'i': $1 = H_INT; break;
|
@@ -377,6 +381,17 @@ PUTVRX_TYPEMAP(NA_DFLOAT,double,NUM2DBL);
|
|
377
381
|
}
|
378
382
|
}
|
379
383
|
|
384
|
+
// Typemap for datasel parameter of sela() and select()
|
385
|
+
%typemap(in) (int datasel) {
|
386
|
+
if($input == Qfalse) {
|
387
|
+
$1 = 0;
|
388
|
+
} else if($input == Qtrue) {
|
389
|
+
$1 = 1;
|
390
|
+
} else {
|
391
|
+
$1 = NUM2INT($input);
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
380
395
|
// Make updated() a predicate method
|
381
396
|
%predicate updated();
|
382
397
|
|
data/ext/miriad_wrap.c
CHANGED
@@ -2517,7 +2517,11 @@ _wrap_Uvio_putvr(int argc, VALUE *argv, VALUE self) {
|
|
2517
2517
|
}
|
2518
2518
|
if (argc > 2) {
|
2519
2519
|
{
|
2520
|
-
|
2520
|
+
if(TYPE(argv[2]) == T_STRING) {
|
2521
|
+
arg5 = (int)((RSTRING(argv[2])->ptr)[0]);
|
2522
|
+
} else {
|
2523
|
+
arg5 = NUM2INT(argv[2]);
|
2524
|
+
}
|
2521
2525
|
switch(arg5) {
|
2522
2526
|
case 'a': arg5 = H_BYTE; break;
|
2523
2527
|
case 'i': arg5 = H_INT; break;
|
@@ -3373,8 +3377,6 @@ _wrap_Uvio_sela(int argc, VALUE *argv, VALUE self) {
|
|
3373
3377
|
int res2 ;
|
3374
3378
|
char *buf2 = 0 ;
|
3375
3379
|
int alloc2 = 0 ;
|
3376
|
-
int val3 ;
|
3377
|
-
int ecode3 = 0 ;
|
3378
3380
|
int res4 ;
|
3379
3381
|
char *buf4 = 0 ;
|
3380
3382
|
int alloc4 = 0 ;
|
@@ -3392,11 +3394,15 @@ _wrap_Uvio_sela(int argc, VALUE *argv, VALUE self) {
|
|
3392
3394
|
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","sela", 2, argv[0] ));
|
3393
3395
|
}
|
3394
3396
|
arg2 = (char *)(buf2);
|
3395
|
-
|
3396
|
-
|
3397
|
-
|
3398
|
-
|
3399
|
-
|
3397
|
+
{
|
3398
|
+
if(argv[1] == Qfalse) {
|
3399
|
+
arg3 = 0;
|
3400
|
+
} else if(argv[1] == Qtrue) {
|
3401
|
+
arg3 = 1;
|
3402
|
+
} else {
|
3403
|
+
arg3 = NUM2INT(argv[1]);
|
3404
|
+
}
|
3405
|
+
}
|
3400
3406
|
res4 = SWIG_AsCharPtrAndSize(argv[2], &buf4, NULL, &alloc4);
|
3401
3407
|
if (!SWIG_IsOK(res4)) {
|
3402
3408
|
SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char *","sela", 4, argv[2] ));
|
@@ -3434,8 +3440,6 @@ _wrap_Uvio_select(int argc, VALUE *argv, VALUE self) {
|
|
3434
3440
|
int res2 ;
|
3435
3441
|
char *buf2 = 0 ;
|
3436
3442
|
int alloc2 = 0 ;
|
3437
|
-
int val3 ;
|
3438
|
-
int ecode3 = 0 ;
|
3439
3443
|
double val4 ;
|
3440
3444
|
int ecode4 = 0 ;
|
3441
3445
|
double val5 ;
|
@@ -3454,11 +3458,15 @@ _wrap_Uvio_select(int argc, VALUE *argv, VALUE self) {
|
|
3454
3458
|
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","select", 2, argv[0] ));
|
3455
3459
|
}
|
3456
3460
|
arg2 = (char *)(buf2);
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
|
3461
|
-
|
3461
|
+
{
|
3462
|
+
if(argv[1] == Qfalse) {
|
3463
|
+
arg3 = 0;
|
3464
|
+
} else if(argv[1] == Qtrue) {
|
3465
|
+
arg3 = 1;
|
3466
|
+
} else {
|
3467
|
+
arg3 = NUM2INT(argv[1]);
|
3468
|
+
}
|
3469
|
+
}
|
3462
3470
|
if (argc > 2) {
|
3463
3471
|
ecode4 = SWIG_AsVal_double(argv[2], &val4);
|
3464
3472
|
if (!SWIG_IsOK(ecode4)) {
|
data/lib/miriad.rb
CHANGED
@@ -7,12 +7,13 @@
|
|
7
7
|
# astronomy related methods to Ruby classes.
|
8
8
|
#
|
9
9
|
#--
|
10
|
-
# $Id: miriad.rb
|
10
|
+
# $Id: miriad.rb 23 2008-04-30 21:42:24Z davidm $
|
11
11
|
#++
|
12
12
|
|
13
13
|
require 'rbconfig'
|
14
14
|
require 'rubygems'
|
15
15
|
require 'date'
|
16
|
+
require 'enumerator'
|
16
17
|
require 'narray'
|
17
18
|
miriad_shared_lib = 'miriad.' + Config::CONFIG['DLEXT']
|
18
19
|
require miriad_shared_lib
|
@@ -126,6 +127,9 @@ class DateTime
|
|
126
127
|
# The J2000 epoch
|
127
128
|
J2000 = civil(2000,1,1,12)
|
128
129
|
|
130
|
+
# The sidereal rotation rate of Earth in radians per second
|
131
|
+
OMEGA = 7.29211538e-5
|
132
|
+
|
129
133
|
# Create a +DateTime+ object from a numeric Astronomical Julian Date.
|
130
134
|
def self.ajd(d)
|
131
135
|
J2000 + d - J2000.ajd
|
@@ -329,7 +333,7 @@ module Miriad
|
|
329
333
|
# and <tt>xyz2</tt> in the direction of +obsra+, +obsdec+ (i.e. right
|
330
334
|
# ascension and declination in the current epoch) at the local apparent
|
331
335
|
# sidereal time +lst+. <tt>xyz1</tt> and <tt>xyz2</tt> are three element
|
332
|
-
# arrays containing
|
336
|
+
# arrays containing equitorial coordinates of the baseline endpoints, and
|
333
337
|
# +obsra+, +obsdec+, and +lst+ are all in radians
|
334
338
|
#
|
335
339
|
# The body of this method was transcribed from the MIRIAD source file
|
@@ -358,7 +362,7 @@ module Miriad
|
|
358
362
|
# call-seq:
|
359
363
|
# Miriad.neu2xyz(n, e, u, latitude) -> [x, y, z]
|
360
364
|
#
|
361
|
-
# Convert topoceptric coordinates to
|
365
|
+
# Convert topoceptric coordinates to equitorial coordinates. If given,
|
362
366
|
# +latitude+ should be in radians. If +latitude+ is not given, the value
|
363
367
|
# from <tt>ENV['LATITUDE']</tt> (which should be in degrees in
|
364
368
|
# <tt>dd:mm:ss.sss</tt> or <tt>dd.ddd</tt> format) will be used.
|
@@ -366,7 +370,10 @@ module Miriad
|
|
366
370
|
# Output coordinates will be in the same units as the input coordinates.
|
367
371
|
#
|
368
372
|
# See also Miriad.xyz2neu
|
369
|
-
def self.neu2xyz(
|
373
|
+
def self.neu2xyz(*args)
|
374
|
+
n, e, u, latitude, extra = args.flatten!
|
375
|
+
latitude ||= ENV.fetch('LATITUDE','0.0').dms_to_d.d2r
|
376
|
+
|
370
377
|
sinlat = Math.sin(latitude)
|
371
378
|
coslat = Math.cos(latitude)
|
372
379
|
[
|
@@ -386,7 +393,7 @@ module Miriad
|
|
386
393
|
# call-seq:
|
387
394
|
# Miriad.xyz2nue(x, y, z, latitude) -> [n, e, u]
|
388
395
|
#
|
389
|
-
# Convert
|
396
|
+
# Convert equitorial coordinates to topocentric coordinates. If given,
|
390
397
|
# +latitude+ should be in radians. If +latitude+ is not given, the value
|
391
398
|
# from <tt>ENV['LATITUDE']</tt> (which should be in degrees in
|
392
399
|
# <tt>dd:mm:ss.sss</tt> or <tt>dd.ddd</tt> format) will be used.
|
@@ -446,6 +453,26 @@ module Miriad
|
|
446
453
|
[az, el]
|
447
454
|
end
|
448
455
|
|
456
|
+
# call-seq: Miriad.fringe_rate(bx, by, obsra, obsdec, lst, freq)
|
457
|
+
#
|
458
|
+
# Computes the Earth rotation synthesis fringe rate for a source at +obsra+
|
459
|
+
# and +obsdec+ at local sidereal time +lst+ and sky frequency +freq+ as seen
|
460
|
+
# by a baseline with X and Y equitorial components +bx+ and +by+.
|
461
|
+
#
|
462
|
+
# The units of the result depends on the the units of the inputs. To get
|
463
|
+
# turns per second (i.e. Hz), +bx+ and +by+ should be in nanoseconds and
|
464
|
+
# +freq+ should be in GHz (alternatively, +bx+ and +by+ in seconds and +freq+
|
465
|
+
# in Hz). To get radians per second, multiply +freq+ by 2*Math::PI. To get
|
466
|
+
# degrees per second, multiply +freq+ by 360.
|
467
|
+
def self.fringe_rate(bx, by, obsra, obsdec, lst, freq)
|
468
|
+
ha = lst - obsra
|
469
|
+
cosha = Math.cos(ha)
|
470
|
+
sinha = Math.sin(ha)
|
471
|
+
cosd = Math.cos(obsdec)
|
472
|
+
|
473
|
+
-freq * DateTime::OMEGA * (bx*sinha + by*cosha) * cosd
|
474
|
+
end
|
475
|
+
|
449
476
|
# call-seq: Miriad.parang(obsra, obsdec, lst, latitude) -> parallactic_angle
|
450
477
|
#
|
451
478
|
# Compute parallactic angle of an altitude-azimuth telescope. Accuracy is
|
@@ -613,8 +640,11 @@ module Miriad
|
|
613
640
|
# call +to_a+ on the returned value (otherwise your +u+ variable might end
|
614
641
|
# up as a three element NArray and +v+ and +w+ nil.)
|
615
642
|
def coord() preamble[0..2]; end
|
643
|
+
# Computes the uv angle (in radians) from this Visibility's preamble using
|
644
|
+
# <tt>atan2(v,u)</tt>.
|
645
|
+
def uvangle() Math.atan2(preamble[1], preamble[0]); end
|
616
646
|
# Computes the uv distance from this Visibility's preamble.
|
617
|
-
def uvdist() Math.
|
647
|
+
def uvdist() Math.hypot(preamble[0], preamble[1]); end
|
618
648
|
# Returns the Julian date from this Visibility's preamble.
|
619
649
|
def jd() preamble[3]; end
|
620
650
|
# Returns the baseline number from this Visibility's preamble.
|
@@ -731,9 +761,119 @@ module Miriad
|
|
731
761
|
vis
|
732
762
|
end
|
733
763
|
|
764
|
+
# call-seq: nants -> Integer
|
765
|
+
#
|
766
|
+
# Returns the current value of the _nants_ uv variable or zero if it is not
|
767
|
+
# (yet) present.
|
768
|
+
def nants
|
769
|
+
getvr('nants') || 0
|
770
|
+
end
|
771
|
+
|
772
|
+
# call-seq:
|
773
|
+
# antpos -> [[0,0,0], [Xa1,Ya1,Za1], ..., [Xan, Yan, Zan]]
|
774
|
+
# antpos(a1, a2) -> [[Xa1,Ya1,Za1], [Xa2, Ya2, Za2]]
|
775
|
+
# antpos([a1, a2]) -> [[Xa1,Ya1,Za1], [Xa2, Ya2, Za2]]
|
776
|
+
# antpos(a) -> [Xa,Ya,Za]
|
777
|
+
#
|
778
|
+
# If called without a parameter (other than the optional Hash, see below),
|
779
|
+
# returns the current value of the _antpos_ uv variable array arranged for
|
780
|
+
# convenient indexing by a 1-based antenna number (e.g. as retuned by
|
781
|
+
# basant). The 0th position in the array contains a [0,0,0] place holder
|
782
|
+
# position.
|
783
|
+
#
|
784
|
+
# If called with multiple integer parameters or an Array of Integers,
|
785
|
+
# returns an array of positions of the specified antennas. In this case,
|
786
|
+
# the returned array will not contain a <tt>[0,0,0]</tt> placeholder in the
|
787
|
+
# 0th position.
|
788
|
+
#
|
789
|
+
# If called with a single Integer parameter, returns the position of the
|
790
|
+
# specified antenna.
|
791
|
+
#
|
792
|
+
# An optional Hash can be passed in as the last parameter to specify units
|
793
|
+
# and coordinates. The following key/value entries are recognized:
|
794
|
+
#
|
795
|
+
# :coord => :xyz:: Position(s) in equitorial coordinates (default)
|
796
|
+
# :coord => :neu:: Position(s) in topocentric coordinates (uses the
|
797
|
+
# _latitude_ uv variable for conversion from XYZ to
|
798
|
+
# NEU)
|
799
|
+
# :coord => :uvw:: Projection of position in the direction of _obsra_
|
800
|
+
# and _obsdec_ at the local apparent sidereal time
|
801
|
+
# _lst_
|
802
|
+
#
|
803
|
+
# :units => :ns:: Position(s) in nanoseconds (default)
|
804
|
+
# :units => :meter:: Position(s) in meters
|
805
|
+
# :units => :lamda:: Position(s) in wavelengths
|
806
|
+
# :units => :klamda:: Position(s) in kilo-wavelengths
|
807
|
+
#
|
808
|
+
# The following are some examples of common usage:
|
809
|
+
#
|
810
|
+
# a1xyz_ns, a2xyz_ns = uvio.antpos(uvio.basant)
|
811
|
+
#
|
812
|
+
# ant5neu_m = uvio.antpos(5, :coord => :neu, :units => :meter)
|
813
|
+
def antpos(*args)
|
814
|
+
opts = {:coord => :xyz, :units => :ns}
|
815
|
+
opts.merge!(args.pop) if Hash === args[-1]
|
816
|
+
return nil unless ap = getvr('antpos')
|
817
|
+
args.flatten!
|
818
|
+
ap = ap.enum_slice(ap.length/3).entries.transpose.unshift([0,0,0])
|
819
|
+
ap = ap.values_at(*args.flatten) if args.length > 0
|
820
|
+
|
821
|
+
# Do units scaling, if requested
|
822
|
+
scale = case opts[:units]
|
823
|
+
when :ns: nil
|
824
|
+
when :meter: Math::CKMS / 1e6
|
825
|
+
when :lambda: getvr('freq') || 1.0
|
826
|
+
when :klambda: (getvr('freq') || 1.0) / 1000
|
827
|
+
else raise "Unrecognized units '#{opts[:units]}'"
|
828
|
+
end
|
829
|
+
ap.map!{|p| p.map!{|c| c*scale}} if scale
|
830
|
+
|
831
|
+
# Do coordinate conversion, if requested
|
832
|
+
if opts[:coord] == :neu
|
833
|
+
latitude = getvr('latitud') || 0.0
|
834
|
+
ap.map!{|p| Miriad.xyz2neu(p,latitude)}
|
835
|
+
elsif opts[:coord] == :uvw
|
836
|
+
obsra = getvr('obsra') || 0.0
|
837
|
+
obsdec = getvr('obsdec') || 0.0
|
838
|
+
lst = getvr('lst') || 0.0
|
839
|
+
ap.map!{|p| Miriad.xyz2uvw([0.0, 0.0, 0.0], p, obsra, obsdec, lst)}
|
840
|
+
elsif opts[:coord] != :xyz
|
841
|
+
raise "Unrecognized coordinate system '#{opts[:coord]}'"
|
842
|
+
end
|
843
|
+
|
844
|
+
# Return single position if only one was asked for
|
845
|
+
args.length == 1 ? ap[0] : ap
|
846
|
+
end
|
847
|
+
|
848
|
+
# call-seq:
|
849
|
+
# baseline -> [bx, by, bz]
|
850
|
+
# baseline(a1, a2) -> [Xa2-Xa1, Ya2-Ya1, Za2-Za1]
|
851
|
+
#
|
852
|
+
# If called without a parameter (other than the optional Hash, see below),
|
853
|
+
# returns the dimensions of the current baseline.
|
854
|
+
#
|
855
|
+
# If called with two antenna numbers, returns the dimension of their
|
856
|
+
# baseline. The two antenna numbers will be swapped if a1 > a2.
|
857
|
+
#
|
858
|
+
# In either case, an optional Hash can be passed in. This hash is passed
|
859
|
+
# to antpos, so see antpos for a decription of what options are available.
|
860
|
+
def baseline(*args)
|
861
|
+
opts = (Hash === args[-1]) ? args.pop : {}
|
862
|
+
a1, a2 = case args.length
|
863
|
+
when 0: basant
|
864
|
+
when 2: args
|
865
|
+
else raise ArgumentError(
|
866
|
+
"wrong number of arguments (#{args.length} for 0 or 2)")
|
867
|
+
end
|
868
|
+
a1, a2 = a2, a1 if a1 > a2
|
869
|
+
p1, p2 = antpos(a1, a2, opts)
|
870
|
+
[p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2]]
|
871
|
+
end
|
872
|
+
|
734
873
|
# call-seq: nchan -> Integer
|
735
874
|
#
|
736
|
-
# Returns the current value of the _nchan_ uv variable or zero if it is not
|
875
|
+
# Returns the current value of the _nchan_ uv variable or zero if it is not
|
876
|
+
# (yet) present.
|
737
877
|
def nchan
|
738
878
|
getvr('nchan') || 0
|
739
879
|
end
|
@@ -769,11 +909,19 @@ module Miriad
|
|
769
909
|
getvr('lst') - getvr('obsra') rescue 0.0
|
770
910
|
end
|
771
911
|
|
912
|
+
# Computes the uv angle (in radians) from the current value of the _coord_
|
913
|
+
# uv variable using <tt>atan2(v,u)</tt>. Returns 0.0 if _coord_ is
|
914
|
+
# undefined or maldefined.
|
915
|
+
def uvangle
|
916
|
+
u, v, w = getvr('coord')
|
917
|
+
(u && v) ? Math.atan2(v, u) : 0.0
|
918
|
+
end
|
919
|
+
|
772
920
|
# Computes the uv distance from the current value of the _coord_ uv
|
773
921
|
# variable. Returns 0.0 if _coord_ is undefined or maldefined.
|
774
922
|
def uvdist
|
775
923
|
u, v, w = getvr('coord')
|
776
|
-
(u && v) ? Math.
|
924
|
+
(u && v) ? Math.hypot(u, v) : 0.0
|
777
925
|
end
|
778
926
|
|
779
927
|
# Computes the azimuth and elevation from the current values of _lst_,
|
@@ -789,6 +937,25 @@ module Miriad
|
|
789
937
|
Miriad.azel(obsra, obsdec, lst, latitude)
|
790
938
|
end
|
791
939
|
|
940
|
+
# Computes the Earth rotation synthesis fringe rate in Hz using the current
|
941
|
+
# values of the _obsra_, _obsdec_, _lst_, _antpos_, and _baseline_ uv
|
942
|
+
# variables. +freq_ghz+ is the sky frequency, in GHz, for which the fringe
|
943
|
+
# rate will be determined. If it is not given, the _freq_ uv variable will
|
944
|
+
# be used.
|
945
|
+
def fringe_hz(freq_ghz = getvr('freq'))
|
946
|
+
bx, by, bz = baseline
|
947
|
+
obsra = getvr('obsra') || 0.0
|
948
|
+
obsdec = getvr('obsdec') || 0.0
|
949
|
+
lst = getvr('lst') || 0.0
|
950
|
+
freq_ghz ||= 0.0
|
951
|
+
Miriad.fringe_rate(bx, by, obsra, obsdec, lst, freq_ghz)
|
952
|
+
end
|
953
|
+
|
954
|
+
# Returns <tt>getvr('inttime')</tt> or 0.0 if it is not (yet) defined.
|
955
|
+
def tau
|
956
|
+
getvr('inttime') || 0.0
|
957
|
+
end
|
958
|
+
|
792
959
|
# Computes the current parallactic angle from the current values of _lst_,
|
793
960
|
# _obsra_, _obsdec_, and _latitude_. Missing components are assumed to be
|
794
961
|
# 0.0.
|
@@ -809,6 +976,31 @@ module Miriad
|
|
809
976
|
getvr('chi') || (parang + (getvr('evector') || 0.0))
|
810
977
|
end
|
811
978
|
|
979
|
+
# Returns a Hash whose keys are the names of all uv variables present in
|
980
|
+
# this dataset, with corresponding values indicating the type code
|
981
|
+
# (suitable for passing to getvr()) of the uv variable.
|
982
|
+
#
|
983
|
+
# This reads the _vartable_ item, thus when using this method on a dataset
|
984
|
+
# opened in 'write' mode, you must call flush() before calling this method,
|
985
|
+
# otherwise the _vartable_ item will be up to date.
|
986
|
+
def vartable
|
987
|
+
v = {}
|
988
|
+
begin
|
989
|
+
item = haccess('vartable','r')
|
990
|
+
rescue
|
991
|
+
return nil
|
992
|
+
end
|
993
|
+
begin
|
994
|
+
while (line = hreadln(item))
|
995
|
+
type, name = line.split
|
996
|
+
v[name] = type[0,1]
|
997
|
+
end
|
998
|
+
ensure
|
999
|
+
hdaccess(item)
|
1000
|
+
end
|
1001
|
+
v
|
1002
|
+
end
|
1003
|
+
|
812
1004
|
# call-seq:
|
813
1005
|
# uvio['name'] -> value or nil
|
814
1006
|
# uvio[:name] -> value or nil
|
@@ -834,10 +1026,12 @@ module Miriad
|
|
834
1026
|
# well only for Strings and NArrays, but not for Numeric types. For full
|
835
1027
|
# control, specify +type+ as one of...
|
836
1028
|
#
|
837
|
-
# * <tt>?a</tt> - ASCII data
|
838
|
-
# * <tt>?i</tt> - Integer data
|
839
|
-
# * <tt>?r</tt> - Single precision real data
|
840
|
-
# * <tt>?d</tt> - Double precision real data
|
1029
|
+
# * <tt>'a'</tt> (or <tt>?a</tt>) - ASCII data
|
1030
|
+
# * <tt>'i'</tt> (or <tt>?i</tt>) - Integer data
|
1031
|
+
# * <tt>'r'</tt> (or <tt>?r</tt>) - Single precision real data
|
1032
|
+
# * <tt>'d'</tt> (or <tt>?d</tt>) - Double precision real data
|
1033
|
+
# * <tt>'c'</tt> (or <tt>?c</tt>) - Single precision complex data [NOT YET
|
1034
|
+
# SUPPORTED!]
|
841
1035
|
def []=(*args)
|
842
1036
|
n, t, v = case args.length
|
843
1037
|
when 2: [args[0], -1, args[1]]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miriad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.0.
|
4
|
+
version: 4.1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David MacMahon
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-04-
|
12
|
+
date: 2008-04-30 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements: []
|
87
87
|
|
88
88
|
rubyforge_project: miriad
|
89
|
-
rubygems_version: 1.1.
|
89
|
+
rubygems_version: 1.1.1
|
90
90
|
signing_key:
|
91
91
|
specification_version: 2
|
92
92
|
summary: Ruby interface to MIRIAD
|