Hello Lester, Maybe with something like that
path = get_absolute_file_path(); f = mopen(fullfile(path, "file.srt"), "rt"); //extract header from file header = []; txt = mgetl(f, 1); while (txt <> "END") header = [header txt]; txt = mgetl(f, 1); end //process header lines st = []; st.COMMENTS = []; for h = header if grep(h, "/^COMMENT\s/", "r") then st.COMMENTS($+1) = stripblanks(strsubst(h, "COMMENT ", "")); continue; end if part(h, 9) == "=" then field = stripblanks(part(h, 1:8)); data = stripblanks(part(h, 11:30)); num = strtod(data); if ~isnan(num) then data = num; end st(field) = data; end end disp(st); // here you can read binary part with mget(f, ...) //and close the file at the end mclose(f); Cordialement / Best Regards, Antoine ELIAS Numerical Computation / Scripting Techno Architecture Senior Manager Office: +33 1 6162 3170 Dassault Systèmes SE | 10 Rue Marcel Dassault, Paris Campus | 78140 Vélizy-Villacoublay | France [3DS Logo] From: users <users-boun...@lists.scilab.org> On Behalf Of Lester Anderson Sent: mardi 13 juin 2023 14:09 To: International users mailing list for Scilab. <users@lists.scilab.org> Subject: [Scilab-users] FITS data load and export 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.0700000000000E+01 /Reference value along axis CDELT1 = -1.5000000000000E-02 /Pixel spacing along axis CRPIX1 = 1.2800000000000E+02 /Reference pixel along axis CUNIT1 = '' /units of coord. values CTYPE2 = 'DEC--TAN' /Type of coordinate axis CRVAL2 = 4.1280000000000E+01 /Reference value along axis CDELT2 = 1.5000000000000E-02 /Pixel spacing along axis CRPIX2 = 1.2800000000000E+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.0000000000000E+00 /Reference pixel along axis CUNIT3 = '' /units of coord. values CTYPE4 = 'STOKES' /Type of coordinate axis CRVAL4 = 1.0000000000000E+00 /Reference value along axis CDELT4 = 1.0000000000000E+00 /Pixel spacing along axis CRPIX4 = 1.0000000000000E+00 /Reference pixel along axis CUNIT4 = '' /units of coord. values PC1_1 = 1.0000000000000E+00 /Transformation matrix element PC2_1 = 0.0000000000000E+00 /Transformation matrix element PC3_1 = 0.0000000000000E+00 /Transformation matrix element PC4_1 = 0.0000000000000E+00 /Transformation matrix element PC1_2 = 0.0000000000000E+00 /Transformation matrix element PC2_2 = 1.0000000000000E+00 /Transformation matrix element PC3_2 = 0.0000000000000E+00 /Transformation matrix element PC4_2 = 0.0000000000000E+00 /Transformation matrix element PC1_3 = 0.0000000000000E+00 /Transformation matrix element PC2_3 = 0.0000000000000E+00 /Transformation matrix element PC3_3 = 1.0000000000000E+00 /Transformation matrix element PC4_3 = 0.0000000000000E+00 /Transformation matrix element PC1_4 = 0.0000000000000E+00 /Transformation matrix element PC2_4 = 0.0000000000000E+00 /Transformation matrix element PC3_4 = 0.0000000000000E+00 /Transformation matrix element PC4_4 = 1.0000000000000E+00 /Transformation matrix element EQUINOX = 2.0000000000000E+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.0920300000580E+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&A...376..359H 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 https://www.3ds.com/privacy-policy/contact/
_______________________________________________ users mailing list - users@lists.scilab.org Click here to unsubscribe: <mailto:users-unsubscr...@lists.scilab.org> https://lists.scilab.org/mailman/listinfo/users