changeset 0:7f5c597801f0 draft

planemo upload for repository https://github.com/esg-epfl-apc/tools-astro/tree/main/tools/astropytools commit b794237f7f48d27404592039d3d9ed50aed621e4
author astroteam
date Wed, 21 May 2025 14:53:34 +0000
parents
children eba50a1f228e
files csv2fits.xml static/images/legacysurvey_image.png test-data/WFPC2u5780205r_c0fx.fits test-data/fitsinfo.out test-data/fitstable.csv test-data/fitstable.fits test-data/fitstable.tsv test-data/legacysurvey_image.fits test-data/legacysurvey_image.png
diffstat 9 files changed, 58 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/csv2fits.xml	Wed May 21 14:53:34 2025 +0000
@@ -0,0 +1,45 @@
+
+<tool id="astropy_csv2fits" name="csv2fits" version="0.1.0+galaxy0" profile="24.0">
+  <requirements>
+    <requirement type="package" version="6.1.7">astropy</requirement>
+  </requirements>
+      <command detect_errors="exit_code"><![CDATA[
+        python '$py_script_file' 
+    ]]></command>
+
+    <configfiles>
+      <configfile name="py_script_file">
+from astropy.io import ascii
+
+t = ascii.read("$input_file", delimiter='$input_file.metadata.delimiter')
+t.write("$output", format='fits', overwrite=True)
+      </configfile>
+    </configfiles>
+  <inputs>
+    <param name="input_file" type="data" label="Input File" format="csv,tsv" optional="false" />
+  </inputs>
+  <outputs>
+    <data name="output" format="fits" />
+  </outputs>
+  <tests>
+    <test expect_num_outputs="1">
+      <param name="input_file" value="fitstable.csv" />
+      <output name="output" file="fitstable.fits" />
+    </test>
+    <test expect_num_outputs="1">
+      <param name="input_file" value="fitstable.tsv" />
+      <output name="output" file="fitstable.fits" />
+    </test>
+  </tests>
+    <help><![CDATA[
+Convert a text table (CSV or TSV) to the binary table in the first extension of the FITS file.
+
+This tool is a simple script based on Astropy package. See `astropy help <https://docs.astropy.org/en/latest/io/fits/>`_
+for further documentation. 
+    ]]></help>
+    <citations>
+        <citation type="doi">
+            10.3847/1538-4357/ac7c74
+        </citation>
+    </citations>
+</tool>
\ No newline at end of file
Binary file static/images/legacysurvey_image.png has changed
Binary file test-data/WFPC2u5780205r_c0fx.fits has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/fitsinfo.out	Wed May 21 14:53:34 2025 +0000
@@ -0,0 +1,3 @@
+No.    Name      Ver    Type      Cards   Dimensions   Format
+  0  PRIMARY       1 PrimaryHDU     262   (200, 200, 4)   float32   
+  1  u5780205r_cvt.c0h.tab    1 TableHDU       353   4R x 49C   [D25.17, D25.17, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, A1, E15.7, I12, I12, D25.17, D25.17, A8, A8, I12, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, I12, I12, I12, I12, I12, I12, I12, I12, A48, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7, E15.7]   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/fitstable.csv	Wed May 21 14:53:34 2025 +0000
@@ -0,0 +1,5 @@
+CRVAL1,CRVAL2,CRPIX1,CRPIX2,CD1_1,CD1_2,CD2_1,CD2_2,DATAMIN,DATAMAX,MIR_REVR,ORIENTAT,FILLCNT,ERRCNT,FPKTTIME,LPKTTIME,CTYPE1,CTYPE2,DETECTOR,DEZERO,BIASEVEN,BIASODD,GOODMIN,GOODMAX,DATAMEAN,GPIXELS,SOFTERRS,CALIBDEF,STATICD,ATODSAT,DATALOST,BADPIXEL,OVERLAP,PHOTMODE,PHOTFLAM,PHOTZPT,PHOTPLAM,PHOTBW,MEDIAN,MEDSHADO,HISTWIDE,SKEWNESS,MEANC10,MEANC25,MEANC50,MEANC100,MEANC200,MEANC300,BACKGRND
+182.6311886308,39.39633673411,420.0,424.5,-1.06704e-06,-1.25958e-05,-1.26016e-05,1.06655e-06,-73.19537,3777.701,T,-85.16,0,0,51229.798573999986,51229.798742000006,RA---TAN,DEC--TAN,1,316.6452,316.6715,316.6189,-5.064006,2552.17,0.4182382,632387,0,1466,0,16,0,0,0,"WFPC2,1,A2D7,LRF#4877.0,,CAL",3.44746e-16,-21.1,4884.258,20.20996,-0.175651,-0.121681,1.033711,-1.983727,0.12958,0.3129676,0.4577668,0.3916293,0.3115222,0.3295493,-0.3676353
+182.6255233634,39.41214313815,423.5,414.0,-2.75605e-05,2.08221e-06,2.08021e-06,2.75871e-05,-19.95751,3740.623,T,4.31638,0,0,51229.798742000006,51229.79891000002,RA---TAN,DEC--TAN,2,354.0573,354.0761,354.0386,-3.379329,3720.573,0.6385469,631340,0,2072,0,25,0,0,0,"WFPC2,2,A2D7,LRF#4877.0,,CAL",3.382652e-16,-21.1,4884.261,20.20992,-0.1896807,-0.1899146,1.053666,-1.947547,0.2564496,0.1057321,0.9952926,0.8409855,0.6534808,0.5836062,0.2101429
+182.6523792305,39.410944281389995,436.0,424.5,2.23913e-06,2.75426e-05,2.75684e-05,-2.23704e-06,-58.53249,3282.136,T,94.6434,0,0,51229.79891000002,51229.799078,RA---TAN,DEC--TAN,3,306.6676,306.6541,306.681,-3.713645,3282.136,0.5217843,633259,0,1551,0,7,0,0,0,"WFPC2,3,A2D7,LRF#4877.0,,CAL",3.372288e-16,-21.1,4884.255,20.21006,0.01109185,0.06184989,1.003236,28.21703,1.669304,0.3472891,0.327215,0.6145074,0.7027547,0.5681439,0.4761558
+182.650022355,39.38946044168,423.0,421.0,2.75358e-05,-2.50931e-06,-2.50689e-06,-2.75624e-05,-72.41166,3420.24,T,-174.798,0,0,51229.799079,51229.79924599999,RA---TAN,DEC--TAN,4,311.7072,311.7648,311.6496,-3.289304,3420.24,0.7084697,628289,0,1816,0,57,0,0,0,"WFPC2,4,A2D7,LRF#4877.0,,CAL",3.46466e-16,-21.1,4884.256,20.20999,-0.06813275,-0.03253493,0.9846212,-4.591252,0.1359666,0.04015671,0.1129934,1.897491,0.9687142,1.05377,0.3466465
Binary file test-data/fitstable.fits has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/fitstable.tsv	Wed May 21 14:53:34 2025 +0000
@@ -0,0 +1,5 @@
+CRVAL1	CRVAL2	CRPIX1	CRPIX2	CD1_1	CD1_2	CD2_1	CD2_2	DATAMIN	DATAMAX	MIR_REVR	ORIENTAT	FILLCNT	ERRCNT	FPKTTIME	LPKTTIME	CTYPE1	CTYPE2	DETECTOR	DEZERO	BIASEVEN	BIASODD	GOODMIN	GOODMAX	DATAMEAN	GPIXELS	SOFTERRS	CALIBDEF	STATICD	ATODSAT	DATALOST	BADPIXEL	OVERLAP	PHOTMODE	PHOTFLAM	PHOTZPT	PHOTPLAM	PHOTBW	MEDIAN	MEDSHADO	HISTWIDE	SKEWNESS	MEANC10	MEANC25	MEANC50	MEANC100	MEANC200	MEANC300	BACKGRND
+182.6311886308	39.39633673411	420.0	424.5	-1.06704e-06	-1.25958e-05	-1.26016e-05	1.06655e-06	-73.19537	3777.701	T	-85.16	0	0	51229.798573999986	51229.798742000006	RA---TAN	DEC--TAN	1	316.6452	316.6715	316.6189	-5.064006	2552.17	0.4182382	632387	0	1466	0	16	0	0	0	WFPC2,1,A2D7,LRF#4877.0,,CAL	3.44746e-16	-21.1	4884.258	20.20996	-0.175651	-0.121681	1.033711	-1.983727	0.12958	0.3129676	0.4577668	0.3916293	0.3115222	0.3295493	-0.3676353
+182.6255233634	39.41214313815	423.5	414.0	-2.75605e-05	2.08221e-06	2.08021e-06	2.75871e-05	-19.95751	3740.623	T	4.31638	0	0	51229.798742000006	51229.79891000002	RA---TAN	DEC--TAN	2	354.0573	354.0761	354.0386	-3.379329	3720.573	0.6385469	631340	0	2072	0	25	0	0	0	WFPC2,2,A2D7,LRF#4877.0,,CAL	3.382652e-16	-21.1	4884.261	20.20992	-0.1896807	-0.1899146	1.053666	-1.947547	0.2564496	0.1057321	0.9952926	0.8409855	0.6534808	0.5836062	0.2101429
+182.6523792305	39.410944281389995	436.0	424.5	2.23913e-06	2.75426e-05	2.75684e-05	-2.23704e-06	-58.53249	3282.136	T	94.6434	0	0	51229.79891000002	51229.799078	RA---TAN	DEC--TAN	3	306.6676	306.6541	306.681	-3.713645	3282.136	0.5217843	633259	0	1551	0	7	0	0	0	WFPC2,3,A2D7,LRF#4877.0,,CAL	3.372288e-16	-21.1	4884.255	20.21006	0.01109185	0.06184989	1.003236	28.21703	1.669304	0.3472891	0.327215	0.6145074	0.7027547	0.5681439	0.4761558
+182.650022355	39.38946044168	423.0	421.0	2.75358e-05	-2.50931e-06	-2.50689e-06	-2.75624e-05	-72.41166	3420.24	T	-174.798	0	0	51229.799079	51229.79924599999	RA---TAN	DEC--TAN	4	311.7072	311.7648	311.6496	-3.289304	3420.24	0.7084697	628289	0	1816	0	57	0	0	0	WFPC2,4,A2D7,LRF#4877.0,,CAL	3.46466e-16	-21.1	4884.256	20.20999	-0.06813275	-0.03253493	0.9846212	-4.591252	0.1359666	0.04015671	0.1129934	1.897491	0.9687142	1.05377	0.3466465
Binary file test-data/legacysurvey_image.fits has changed
Binary file test-data/legacysurvey_image.png has changed