Commit 74170d629fc45d3a81ba7a499da186058127664e

Authored by Alain Klotz
1 parent ecf246ab
Exists in master

Add method cards.

Showing 1 changed file with 20 additions and 0 deletions   Show diff stats
src/guitastro/ima.py
... ... @@ -255,6 +255,9 @@ class Ima(ImaException, FileNames):
255 255 def __repr__(self):
256 256 return str(self)
257 257  
  258 + def __array__(self):
  259 + return self._array
  260 +
258 261 def _ima2astrotable_metadata(self):
259 262 for key in self.getkwds():
260 263 val = self.getkwd(key)
... ... @@ -573,6 +576,23 @@ class Ima(ImaException, FileNames):
573 576 cards = self._hdu.header.cards
574 577 return cards
575 578  
  579 + def cards(self):
  580 + """Get all the FITS header cards as a list of tuple.
  581 +
  582 + This method is used by libtt because the type Cards of astropy is bugged for iterator.
  583 + ::
  584 +
  585 + ima1 = Ima()
  586 + cards = ima1.cards()
  587 +
  588 + """
  589 + self._verify_buffer()
  590 + cards = self._hdu.header.cards
  591 + lcards = []
  592 + for card in cards:
  593 + lcards.append(tuple(card))
  594 + return lcards
  595 +
576 596 # =============================================
577 597 # Input/output of a buffer with disk
578 598 # =============================================
... ...