From 74170d629fc45d3a81ba7a499da186058127664e Mon Sep 17 00:00:00 2001 From: Alain Klotz Date: Wed, 26 Jul 2023 14:45:17 +0200 Subject: [PATCH] Add method cards. --- src/guitastro/ima.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+), 0 deletions(-) diff --git a/src/guitastro/ima.py b/src/guitastro/ima.py index 0027df6..9f42457 100644 --- a/src/guitastro/ima.py +++ b/src/guitastro/ima.py @@ -255,6 +255,9 @@ class Ima(ImaException, FileNames): def __repr__(self): return str(self) + def __array__(self): + return self._array + def _ima2astrotable_metadata(self): for key in self.getkwds(): val = self.getkwd(key) @@ -573,6 +576,23 @@ class Ima(ImaException, FileNames): cards = self._hdu.header.cards return cards + def cards(self): + """Get all the FITS header cards as a list of tuple. + + This method is used by libtt because the type Cards of astropy is bugged for iterator. + :: + + ima1 = Ima() + cards = ima1.cards() + + """ + self._verify_buffer() + cards = self._hdu.header.cards + lcards = [] + for card in cards: + lcards.append(tuple(card)) + return lcards + # ============================================= # Input/output of a buffer with disk # ============================================= -- libgit2 0.21.2