Class: VORuby::Resolver::Sesame::ResolvedInfo
- Inherits:
-
Object
- Object
- VORuby::Resolver::Sesame::ResolvedInfo
- Defined in:
- lib/voruby/resolver/sesame.rb
Overview
A simple object that represents a name resolution attempt.
Instance Attribute Summary collapse
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
-
#aliases ⇒ Object
A list of aliases for the object.
- #code ⇒ Object
-
#err_de_mas ⇒ Object
The error of the declination in milliarcseconds.
-
#err_ra_mas ⇒ Object
The error of the right ascension in milliarcseconds.
-
#err_vel ⇒ Object
The error in the velocity of the object in km/s.
-
#errors ⇒ Object
Any errors accompanying the name resolution.
-
#errz ⇒ Object
The error in the redshift of the object.
-
#infos ⇒ Object
Any info accompanying the name resolution.
-
#initialize(xml) ⇒ ResolvedInfo
constructor
Create a ResolvedInfo object from an appropriate XML::Node (one that represents a <Resolver> XML element).
-
#jdedeg ⇒ Object
The J2000 declination of the object in decimal degrees.
-
#jpos ⇒ Object
The J2000 coordinates of the object in sexigesimal format (i.e. ‘13:29:52.36 +47:11:40.8’).
-
#jradeg ⇒ Object
The J2000 right ascension of the object in decimal degrees.
-
#mtype ⇒ Object
The morphological type of the object (i.e. Sc).
-
#name ⇒ Object
The name of the resolver (i.e. Simbad).
-
#nrefs ⇒ Object
The number of references to this object.
-
#oname ⇒ Object
The canonical name of the object.
-
#otype ⇒ Object
The classification of the object (i.e. Seyfert_2 or QSO).
-
#position(as = :degrees) ⇒ Object
The J2000 position of the object in degrees or sexigesimal format.
-
#ref_pos ⇒ Object
A bibcode that corresponds to the publication in which the position of the object was determined.
-
#ref_vel ⇒ Object
A bibcode that corresponds to the publication in which the velocity of the object was determined.
-
#refz ⇒ Object
A bibcode that corresponds to the publication in which the redshift of the object was determined.
-
#sptype ⇒ Object
The spectral type of the object (i.e. A10).
-
#vel ⇒ Object
The velocity of the object in km/s.
-
#z ⇒ Object
The redshift of the object.
Constructor Details
#initialize(xml) ⇒ ResolvedInfo
Create a ResolvedInfo object from an appropriate XML::Node (one that represents a <Resolver> XML element).
165 166 167 |
# File 'lib/voruby/resolver/sesame.rb', line 165 def initialize(xml) @xml = xml end |
Instance Attribute Details
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
161 162 163 |
# File 'lib/voruby/resolver/sesame.rb', line 161 def xml @xml end |
Instance Method Details
#aliases ⇒ Object
A list of aliases for the object. Returns a list of strings.
280 281 282 |
# File 'lib/voruby/resolver/sesame.rb', line 280 def aliases self.xml.find('alias').collect{ |a| a.content } end |
#code ⇒ Object
174 175 176 |
# File 'lib/voruby/resolver/sesame.rb', line 174 def code self.xml['code'] end |
#err_de_mas ⇒ Object
The error of the declination in milliarcseconds.
222 223 224 |
# File 'lib/voruby/resolver/sesame.rb', line 222 def err_de_mas self.xml.find_first('errDEmas').content.to_f if self.xml.find_first('errDEmas') end |
#err_ra_mas ⇒ Object
The error of the right ascension in milliarcseconds.
217 218 219 |
# File 'lib/voruby/resolver/sesame.rb', line 217 def err_ra_mas self.xml.find_first('errRAmas').content.to_f if self.xml.find_first('errRAmas') end |
#err_vel ⇒ Object
The error in the velocity of the object in km/s.
248 249 250 |
# File 'lib/voruby/resolver/sesame.rb', line 248 def err_vel self.xml.find_first('errVel').content.to_if if self.xml.find_first('errVel') end |
#errors ⇒ Object
Any errors accompanying the name resolution. Returns an array of string.
186 187 188 |
# File 'lib/voruby/resolver/sesame.rb', line 186 def errors self.xml.find('ERROR').collect{ |e| e.content } end |
#errz ⇒ Object
The error in the redshift of the object.
232 233 234 |
# File 'lib/voruby/resolver/sesame.rb', line 232 def errz self.xml.find_first('errz').content.to_i if self.xml.find_first('errz') end |
#infos ⇒ Object
Any info accompanying the name resolution. Returns an array of strings.
180 181 182 |
# File 'lib/voruby/resolver/sesame.rb', line 180 def infos self.xml.find('INFO').collect{ |i| i.content } end |
#jdedeg ⇒ Object
The J2000 declination of the object in decimal degrees.
206 207 208 |
# File 'lib/voruby/resolver/sesame.rb', line 206 def jdedeg self.xml.find_first('jdedeg').content.to_f if self.xml.find_first('jdedeg') end |
#jpos ⇒ Object
The J2000 coordinates of the object in sexigesimal format (i.e. ‘13:29:52.36 +47:11:40.8’)
196 197 198 |
# File 'lib/voruby/resolver/sesame.rb', line 196 def jpos self.xml.find_first('jpos').content if self.xml.find_first('jpos') end |
#jradeg ⇒ Object
The J2000 right ascension of the object in decimal degrees.
201 202 203 |
# File 'lib/voruby/resolver/sesame.rb', line 201 def jradeg self.xml.find_first('jradeg').content.to_f if self.xml.find_first('jradeg') end |
#mtype ⇒ Object
The morphological type of the object (i.e. Sc).
259 260 261 |
# File 'lib/voruby/resolver/sesame.rb', line 259 def mtype self.xml.find_first('MType').content if self.xml.find_first('MType') end |
#name ⇒ Object
The name of the resolver (i.e. Simbad).
170 171 172 |
# File 'lib/voruby/resolver/sesame.rb', line 170 def name self.xml['name'] end |
#nrefs ⇒ Object
The number of references to this object.
274 275 276 |
# File 'lib/voruby/resolver/sesame.rb', line 274 def nrefs self.xml.find_first('nrefs').content.to_i if self.xml.find_first('nrefs') end |
#oname ⇒ Object
The canonical name of the object.
269 270 271 |
# File 'lib/voruby/resolver/sesame.rb', line 269 def oname self.xml.find_first('oname').content if self.xml.find_first('oname') end |
#otype ⇒ Object
The classification of the object (i.e. Seyfert_2 or QSO).
191 192 193 |
# File 'lib/voruby/resolver/sesame.rb', line 191 def otype self.xml.find_first('otype').content if self.xml.find_first('otype') end |
#position(as = :degrees) ⇒ Object
The J2000 position of the object in degrees or sexigesimal format.
info.position(:degrees) # => [202.4682083, 47.1946667]
info.position(:sexigesimal) # => ['13:29:52.36', '+47:11:40.8']
287 288 289 290 291 292 293 |
# File 'lib/voruby/resolver/sesame.rb', line 287 def position(as=:degrees) case as when :sexigesimal then (self.jpos || '').split(/\s+/) else [self.jradeg, self.jdedeg] end end |
#ref_pos ⇒ Object
A bibcode that corresponds to the publication in which the position of the object was determined.
212 213 214 |
# File 'lib/voruby/resolver/sesame.rb', line 212 def ref_pos self.xml.find_first('refPos').content if self.xml.find_first('refPos') end |
#ref_vel ⇒ Object
A bibcode that corresponds to the publication in which the velocity of the object was determined.
254 255 256 |
# File 'lib/voruby/resolver/sesame.rb', line 254 def ref_vel self.xml.find_first('refVel').content if self.xml.find_first('refVel') end |
#refz ⇒ Object
A bibcode that corresponds to the publication in which the redshift of the object was determined.
238 239 240 |
# File 'lib/voruby/resolver/sesame.rb', line 238 def refz self.xml.find_first('refz').content if self.xml.find_first('refz') end |
#sptype ⇒ Object
The spectral type of the object (i.e. A10)
264 265 266 |
# File 'lib/voruby/resolver/sesame.rb', line 264 def sptype self.xml.find_first('spType').content if self.xml.find_first('spType') end |
#vel ⇒ Object
The velocity of the object in km/s.
243 244 245 |
# File 'lib/voruby/resolver/sesame.rb', line 243 def vel self.xml.find_first('Vel').content.to_f if self.xml.find_first('Vel') end |
#z ⇒ Object
The redshift of the object.
227 228 229 |
# File 'lib/voruby/resolver/sesame.rb', line 227 def z self.xml.find_first('z').content.to_f if self.xml.find_first('z') end |