Class: VORuby::STC::V1_30::HealpixType

Inherits:
CoordFlavorType show all
Defined in:
lib/voruby/stc/1.30/stc.rb

Overview

2-D Healpix coordinates; defaults for H(4) and K(3).

Direct Known Subclasses

HEALPIX

Instance Attribute Summary collapse

Attributes inherited from CoordFlavorType

#coord_naxes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CoordFlavorType

coord_flavor_from_xml

Methods included from SerializableToXml

#element

Constructor Details

#initialize(healpix_h = 4, healpix_k = 3, coord_naxes = 2) ⇒ HealpixType

Returns a new instance of HealpixType.



7482
7483
7484
7485
7486
# File 'lib/voruby/stc/1.30/stc.rb', line 7482

def initialize(healpix_h=4, healpix_k=3, coord_naxes=2)
  super(coord_naxes)
  self.healpix_h = healpix_h || 4
  self.healpix_k = healpix_k || 3
end

Instance Attribute Details

#healpix_hObject

Returns the value of attribute healpix_h.



7480
7481
7482
# File 'lib/voruby/stc/1.30/stc.rb', line 7480

def healpix_h
  @healpix_h
end

#healpix_kObject

Returns the value of attribute healpix_k.



7480
7481
7482
# File 'lib/voruby/stc/1.30/stc.rb', line 7480

def healpix_k
  @healpix_k
end

Class Method Details

.from_xml(xml) ⇒ Object



7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
# File 'lib/voruby/stc/1.30/stc.rb', line 7513

def self.from_xml(xml)
  root = element_from(xml)
  
  hh = root.attributes.get_attribute_ns(obj_ns.uri, 'healpix_H')
  hk = root.attributes.get_attribute_ns(obj_ns.uri, 'healpix_K')
  
  self.new(
    hh ? Integer(hh.value) : nil,
    hk ? Integer(hk.value) : nil,
    *CoordFlavorType.coord_flavor_from_xml(root)
  )
end

Instance Method Details

#==(h) ⇒ Object



7498
7499
7500
7501
7502
# File 'lib/voruby/stc/1.30/stc.rb', line 7498

def ==(h)
  super(h) and
  self.healpix_h == h.healpix_h and
  self.healpix_k == h.healpix_k
end

#to_xml(name = nil) ⇒ Object



7504
7505
7506
7507
7508
7509
7510
7511
# File 'lib/voruby/stc/1.30/stc.rb', line 7504

def to_xml(name=nil)
  el = super(name)
  
  el.attributes["#{obj_ns.prefix}:healpix_H"] = self.healpix_h.to_s
  el.attributes["#{obj_ns.prefix}:healpix_K"] = self.healpix_k.to_s
  
  el
end