Re: [Scilab-users] FITS data load and export

2023-06-14 Thread Stéphane Mottelet

Hello,

Do you have a sample file somewhere  ? The format is well documented at

https://fits.gsfc.nasa.gov/fits_primer.html

and  I think it won't be that complicated to read the file with a dedicated 
scilab function that first parses the header, determines the length of it after 
padding, then switch to binary mode to read the rest, then reshape the obtained 
matrix knowing NAXIS1,..,NAXIS4 dimensions.

If the file is too big please repost on https://scilab.discourse.group, which 
allows the attachment of large files of any type.

S.

Le 13/06/2023 à 14:09, Lester Anderson a écrit :
Hello,

I have a small FITS file that is 4D and was wondering if this can be loaded 
into Scilab and saved out as a csv file?

The header looks like this:

SIMPLE  =T /file does conform to FITS standard
BITPIX  =  -32 /bits per data value
NAXIS   =4 /number of data axes
NAXIS1  =  256 /size of the axis
NAXIS2  =  256 /size of the axis
NAXIS3  =1 /size of the axis
NAXIS4  =1 /size of the axis
BUNIT   = 'JY/BEAM'/Units of data
WCSNAME = ''   /Coordinate system name
WCSAXES =4 /WCS dimensionality
CTYPE1  = 'RA---TAN'   /Type of coordinate axis
CRVAL1  =  1.07000E+01 /Reference value along axis
CDELT1  = -1.5E-02 /Pixel spacing along axis
CRPIX1  =  1.28000E+02 /Reference pixel along axis
CUNIT1  = ''   /units of coord. values
CTYPE2  = 'DEC--TAN'   /Type of coordinate axis
CRVAL2  =  4.12800E+01 /Reference value along axis
CDELT2  =  1.5E-02 /Pixel spacing along axis
CRPIX2  =  1.28000E+02 /Reference pixel along axis
CUNIT2  = ''   /units of coord. values
CTYPE3  = 'FREQ'   /Type of coordinate axis
CRVAL3  =  6.6251892089844E+09 /Reference value along axis
CDELT3  =  1.2506103515625E+09 /Pixel spacing along axis
CRPIX3  =  1.0E+00 /Reference pixel along axis
CUNIT3  = ''   /units of coord. values
CTYPE4  = 'STOKES' /Type of coordinate axis
CRVAL4  =  1.0E+00 /Reference value along axis
CDELT4  =  1.0E+00 /Pixel spacing along axis
CRPIX4  =  1.0E+00 /Reference pixel along axis
CUNIT4  = ''   /units of coord. values
PC1_1   =  1.0E+00 /Transformation matrix element
PC2_1   =  0.0E+00 /Transformation matrix element
PC3_1   =  0.0E+00 /Transformation matrix element
PC4_1   =  0.0E+00 /Transformation matrix element
PC1_2   =  0.0E+00 /Transformation matrix element
PC2_2   =  1.0E+00 /Transformation matrix element
PC3_2   =  0.0E+00 /Transformation matrix element
PC4_2   =  0.0E+00 /Transformation matrix element
PC1_3   =  0.0E+00 /Transformation matrix element
PC2_3   =  0.0E+00 /Transformation matrix element
PC3_3   =  1.0E+00 /Transformation matrix element
PC4_3   =  0.0E+00 /Transformation matrix element
PC1_4   =  0.0E+00 /Transformation matrix element
PC2_4   =  0.0E+00 /Transformation matrix element
PC3_4   =  0.0E+00 /Transformation matrix element
PC4_4   =  1.0E+00 /Transformation matrix element
EQUINOX =  2.0E+03 /Equinox of equatorial coordinates
INSTRUME= 'SRT'/
FRAME   = 'EQ' /
MINELE  =  5.1408972590790E+01 /
MAXELE  =  7.5454308414980E+01 /
MINAZI  =  2.7738512539560E+02 /
MAXAZI  =  2.9212810099520E+02 /
MINTIME =  5.7566295501250E+04 /
MAXTIME =  5.7566375033940E+04 /
MINUT   =  7.092030580E+00 /
MAXUT   =  9.0008145599859E+00 /
COMMENT  
COMMENT The Sardinia Radio Telescope (SRT) is funded by the Ministry of
COMMENT University and Research (MIUR), Italian Space Agency (ASI), the
COMMENT Autonomous Region of Sardinia (RAS), the European Union (EU) and is
COMMENT operated for the National Institute for Astrophysics (INAF) by
COMMENT Cagliari Observatory (OAC)
COMMENT
COMMENT Telescope : Sardinia Radio Telescope
COMMENT Project : S0007
COMMENT Project P.I. : Prof. Elia Stefano Battistelli
COMMENT Map Reference: Fatigoni S. et al. 2021
COMMENT DOI: https://doi.org/10.1051/0004-6361/202040011
COMMENT
COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy
COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A
COMMENT This FITS file has been created by SIproject version 19AGO2018
COMMENT Creation date: Sat Nov 10 12:08:07 2018
END

The data file itself is a binary structure. Not sure how to handle this odd 
format!

Any ideas?

Lester

This email and any attachments are intended solely for the use of the 
individual or entity to whom it is addressed and may be confidential and/or 
privileged.

If you are not 

[Scilab-users] FITS data load and export

2023-06-14 Thread Lester Anderson
Hello,

I have a small FITS file that is 4D and was wondering if this can be loaded 
into Scilab and saved out as a csv file?

The header looks like this:

SIMPLE  =T /file does conform to FITS standard
BITPIX  =  -32 /bits per data value
NAXIS   =4 /number of data axes
NAXIS1  =  256 /size of the axis
NAXIS2  =  256 /size of the axis
NAXIS3  =1 /size of the axis
NAXIS4  =1 /size of the axis
BUNIT   = 'JY/BEAM'/Units of data
WCSNAME = ''   /Coordinate system name
WCSAXES =4 /WCS dimensionality
CTYPE1  = 'RA---TAN'   /Type of coordinate axis
CRVAL1  =  1.07000E+01 /Reference value along axis
CDELT1  = -1.5E-02 /Pixel spacing along axis
CRPIX1  =  1.28000E+02 /Reference pixel along axis
CUNIT1  = ''   /units of coord. values
CTYPE2  = 'DEC--TAN'   /Type of coordinate axis
CRVAL2  =  4.12800E+01 /Reference value along axis
CDELT2  =  1.5E-02 /Pixel spacing along axis
CRPIX2  =  1.28000E+02 /Reference pixel along axis
CUNIT2  = ''   /units of coord. values
CTYPE3  = 'FREQ'   /Type of coordinate axis
CRVAL3  =  6.6251892089844E+09 /Reference value along axis
CDELT3  =  1.2506103515625E+09 /Pixel spacing along axis
CRPIX3  =  1.0E+00 /Reference pixel along axis
CUNIT3  = ''   /units of coord. values
CTYPE4  = 'STOKES' /Type of coordinate axis
CRVAL4  =  1.0E+00 /Reference value along axis
CDELT4  =  1.0E+00 /Pixel spacing along axis
CRPIX4  =  1.0E+00 /Reference pixel along axis
CUNIT4  = ''   /units of coord. values
PC1_1   =  1.0E+00 /Transformation matrix element
PC2_1   =  0.0E+00 /Transformation matrix element
PC3_1   =  0.0E+00 /Transformation matrix element
PC4_1   =  0.0E+00 /Transformation matrix element
PC1_2   =  0.0E+00 /Transformation matrix element
PC2_2   =  1.0E+00 /Transformation matrix element
PC3_2   =  0.0E+00 /Transformation matrix element
PC4_2   =  0.0E+00 /Transformation matrix element
PC1_3   =  0.0E+00 /Transformation matrix element
PC2_3   =  0.0E+00 /Transformation matrix element
PC3_3   =  1.0E+00 /Transformation matrix element
PC4_3   =  0.0E+00 /Transformation matrix element
PC1_4   =  0.0E+00 /Transformation matrix element
PC2_4   =  0.0E+00 /Transformation matrix element
PC3_4   =  0.0E+00 /Transformation matrix element
PC4_4   =  1.0E+00 /Transformation matrix element
EQUINOX =  2.0E+03 /Equinox of equatorial coordinates
INSTRUME= 'SRT'/
FRAME   = 'EQ' /
MINELE  =  5.1408972590790E+01 /
MAXELE  =  7.5454308414980E+01 /
MINAZI  =  2.7738512539560E+02 /
MAXAZI  =  2.9212810099520E+02 /
MINTIME =  5.7566295501250E+04 /
MAXTIME =  5.7566375033940E+04 /
MINUT   =  7.092030580E+00 /
MAXUT   =  9.0008145599859E+00 /
COMMENT  
COMMENT The Sardinia Radio Telescope (SRT) is funded by the Ministry of
COMMENT University and Research (MIUR), Italian Space Agency (ASI), the
COMMENT Autonomous Region of Sardinia (RAS), the European Union (EU) and is
COMMENT operated for the National Institute for Astrophysics (INAF) by
COMMENT Cagliari Observatory (OAC)
COMMENT
COMMENT Telescope : Sardinia Radio Telescope
COMMENT Project : S0007
COMMENT Project P.I. : Prof. Elia Stefano Battistelli
COMMENT Map Reference: Fatigoni S. et al. 2021
COMMENT DOI: https://doi.org/10.1051/0004-6361/202040011
COMMENT
COMMENT FITS (Flexible Image Transport System) format is defined in 'Astronomy
COMMENT and Astrophysics', volume 376, page 359; bibcode: 2001A
COMMENT This FITS file has been created by SIproject version 19AGO2018
COMMENT Creation date: Sat Nov 10 12:08:07 2018
END

The data file itself is a binary structure. Not sure how to handle this odd 
format!

Any ideas?

Lester

This email and any attachments are intended solely for the use of the 
individual or entity to whom it is addressed and may be confidential and/or 
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this email 
and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or 
responsibility for any use of or reliance on this email.


Please be informed that your personal data are processed according to our data 
privacy policy as described on our website. Should you have any questions 
related to personal data protection, please contact 3DS Data Protection Officer