tidy up main script making use of new query library

This commit is contained in:
Thibault Barnouin
2023-05-10 13:03:54 +02:00
parent 4b95bdc673
commit b566052b07
12 changed files with 11363 additions and 553 deletions

View File

@@ -1,2 +0,0 @@
TELECHARGER DONNEES HST
https://archive.stsci.edu/hst/search.php

View File

@@ -1,363 +0,0 @@
<mxfile host="65bd71144e">
<diagram id="CtGNTGl2CvL_PHKWBocC" name="Page-1">
<mxGraphModel dx="1982" dy="1180" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="2" value="Raw Data" style="swimlane;horizontal=0;whiteSpace=wrap;html=1;container=0;" parent="1" vertex="1">
<mxGeometry x="140" y="98" width="620" height="90" as="geometry">
<mxRectangle x="111" y="160" width="40" height="80" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="13" value="HST Legacy Archive" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" parent="1" vertex="1">
<mxGeometry x="399" y="13" width="120" height="70" as="geometry"/>
</mxCell>
<mxCell id="152" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.605;entryY=0.004;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="38" target="113" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="38" value="Pol 120" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="572" y="384" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="149" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.6;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="34" target="111" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="34" value="Pol 60" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="346" y="384" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="141" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.598;entryY=0.01;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="6" target="106" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="6" value="Pol 0" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="120" y="384" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="153" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.606;entryY=-0.036;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="37" target="114" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="154" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.75;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0;exitDx=70;exitDy=80;exitPerimeter=0;" parent="1" source="37" target="113" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="37" value="Uncertainty 120" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="678" y="384" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="150" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.602;entryY=0.01;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="33" target="112" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="155" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.75;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0;exitDx=70;exitDy=80;exitPerimeter=0;" parent="1" source="33" target="111" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="33" value="Uncertainty 60" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="452" y="384" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="145" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.75;entryY=0;entryDx=0;entryDy=0;exitX=0;exitY=0;exitDx=70;exitDy=80;exitPerimeter=0;" parent="1" source="7" target="106" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="151" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.599;entryY=-0.012;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="7" target="110" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="7" value="Uncertainty 0" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="226" y="384" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="259" style="edgeStyle=none;html=1;elbow=vertical;" parent="1" source="106" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="170" y="567" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="106" value="Pol 0" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;rotation=0;" parent="1" vertex="1">
<mxGeometry x="120" y="485" width="100" height="60" as="geometry"/>
</mxCell>
<mxCell id="260" style="edgeStyle=none;html=1;elbow=vertical;" parent="1" source="110" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="276" y="567" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="110" value="Uncertainty 0" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;rotation=0;" parent="1" vertex="1">
<mxGeometry x="226" y="485" width="100" height="60" as="geometry"/>
</mxCell>
<mxCell id="262" style="edgeStyle=none;html=1;elbow=vertical;" parent="1" source="111" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="396" y="567" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="111" value="Pol 60" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;rotation=0;" parent="1" vertex="1">
<mxGeometry x="346" y="485" width="100" height="60" as="geometry"/>
</mxCell>
<mxCell id="263" style="edgeStyle=none;html=1;elbow=vertical;" parent="1" source="112" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="502" y="567" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="112" value="Uncertainty 60" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;rotation=0;" parent="1" vertex="1">
<mxGeometry x="452" y="485" width="100" height="60" as="geometry"/>
</mxCell>
<mxCell id="264" style="edgeStyle=none;html=1;elbow=vertical;" parent="1" source="113" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="622" y="567" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="113" value="Pol 120" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;rotation=0;" parent="1" vertex="1">
<mxGeometry x="572" y="485" width="100" height="60" as="geometry"/>
</mxCell>
<mxCell id="265" style="edgeStyle=none;html=1;elbow=vertical;" parent="1" source="114" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="728" y="567" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="114" value="Uncertainty 120" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;rotation=0;" parent="1" vertex="1">
<mxGeometry x="678" y="485" width="100" height="60" as="geometry"/>
</mxCell>
<mxCell id="195" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.5;entryY=0.063;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="38" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="631.9999999999998" y="361" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="171" value="Pol 120" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="572" y="287" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="193" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.5;entryY=0.063;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="34" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="406" y="361" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="172" value="Pol 60" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="346" y="287" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="191" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.5;entryY=0.063;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="6" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="180" y="361" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="173" value="Pol 0" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="120" y="287" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="196" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.5;entryY=0.063;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="37" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="738" y="361" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="174" value="Uncertainty 120" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="678" y="287" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="175" value="Uncertainty 60" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="452" y="287" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="176" value="Uncertainty 0" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;container=0;flipH=1;" parent="1" vertex="1">
<mxGeometry x="226" y="287" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="187" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.475;entryY=0.125;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="171" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="683" y="269" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="188" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.525;entryY=0.125;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="174" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="683" y="269" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="177" value="HWP 120.0" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;flipH=1;container=0;" parent="1" vertex="1">
<mxGeometry x="623" y="192" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="185" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.508;entryY=0.125;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="172" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="460.0000000000002" y="269" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="186" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.475;entryY=0.125;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="175" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="460.0000000000002" y="269" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="178" value="HWP 60.0" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;flipH=1;container=0;" parent="1" vertex="1">
<mxGeometry x="400" y="192" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="183" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.458;entryY=0.125;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="173" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="234" y="269" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="184" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.508;entryY=0.125;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" target="176" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="234" y="269" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="179" value="HWP 0.0" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;flipH=1;container=0;" parent="1" vertex="1">
<mxGeometry x="174" y="192" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="221" style="edgeStyle=orthogonalEdgeStyle;html=1;elbow=vertical;exitX=0.436;exitY=1.002;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="173" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="286" y="375" as="targetPoint"/>
<mxPoint x="187.80000000000018" y="362.48" as="sourcePoint"/>
<Array as="points">
<mxPoint x="188" y="375"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="192" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.5;entryY=0.063;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.5;exitY=1.002;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="176" target="7" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="286" y="361" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="222" style="edgeStyle=orthogonalEdgeStyle;html=1;elbow=vertical;exitX=0.452;exitY=1.002;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="172" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="512" y="375" as="targetPoint"/>
<mxPoint x="411.88" y="361.76" as="sourcePoint"/>
<Array as="points">
<mxPoint x="412" y="375"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="194" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.5;entryY=0.063;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.5;exitY=1.002;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="175" target="33" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="511.9999999999998" y="361" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="241" style="edgeStyle=orthogonalEdgeStyle;html=1;entryX=0.488;entryY=0.138;entryDx=0;entryDy=0;entryPerimeter=0;elbow=vertical;" parent="1" target="178" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="461.48275862068976" y="177.9999999999999" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="242" style="edgeStyle=orthogonalEdgeStyle;html=1;entryX=0.488;entryY=0.138;entryDx=0;entryDy=0;entryPerimeter=0;elbow=vertical;" parent="1" target="177" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="684.5172413793102" y="177.9999999999999" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="243" style="edgeStyle=orthogonalEdgeStyle;html=1;entryX=0.488;entryY=0.138;entryDx=0;entryDy=0;entryPerimeter=0;elbow=vertical;" parent="1" target="179" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="235.48275862068954" y="177.9999999999999" as="sourcePoint"/>
</mxGeometry>
</mxCell>
<mxCell id="35" value="HWP 120.0" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;flipH=1;container=0;" parent="1" vertex="1">
<mxGeometry x="624.5" y="103" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="26" value="HWP 60.0" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;movable=1;resizable=1;rotatable=1;deletable=1;editable=1;connectable=1;flipH=1;container=0;" parent="1" vertex="1">
<mxGeometry x="401.5" y="103" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="4" value="HWP 0.0" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;flipH=1;container=0;" parent="1" vertex="1">
<mxGeometry x="175.5" y="103" width="120" height="80" as="geometry"/>
</mxCell>
<mxCell id="244" value="Crop Data" style="html=1;shadow=0;dashed=0;align=center;verticalAlign=middle;shape=mxgraph.arrows2.arrow;dy=0;dx=10;notch=0;sketch=0;fillColor=default;" parent="1" vertex="1">
<mxGeometry x="10" y="180" width="130" height="17.7165" as="geometry"/>
</mxCell>
<mxCell id="245" value="Subtract Background" style="html=1;shadow=0;dashed=0;align=center;verticalAlign=middle;shape=mxgraph.arrows2.arrow;dy=0;dx=10;notch=0;sketch=0;fillColor=default;" parent="1" vertex="1">
<mxGeometry x="10" y="275" width="130" height="17.7165" as="geometry"/>
</mxCell>
<mxCell id="246" value="Align Data" style="html=1;shadow=0;dashed=0;align=center;verticalAlign=middle;shape=mxgraph.arrows2.arrow;dy=0;dx=10;notch=0;sketch=0;fillColor=default;" parent="1" vertex="1">
<mxGeometry x="10" y="369" width="130" height="17.7165" as="geometry"/>
</mxCell>
<mxCell id="247" value="Combine Data" style="html=1;shadow=0;dashed=0;align=center;verticalAlign=middle;shape=mxgraph.arrows2.arrow;dy=0;dx=10;notch=0;sketch=0;fillColor=default;" parent="1" vertex="1">
<mxGeometry x="10" y="466" width="130" height="17.7165" as="geometry"/>
</mxCell>
<mxCell id="225" style="edgeStyle=orthogonalEdgeStyle;html=1;elbow=vertical;exitX=0.433;exitY=0.995;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="171" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="738" y="375" as="targetPoint"/>
<mxPoint x="639.9199999999998" y="362.48" as="sourcePoint"/>
<Array as="points">
<mxPoint x="640" y="375"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="274" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;elbow=vertical;" parent="1" source="248" target="268" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="248" value="Stokes" style="swimlane;horizontal=0;whiteSpace=wrap;html=1;container=0;" parent="1" vertex="1">
<mxGeometry x="120" y="567" width="680" height="103" as="geometry">
<mxRectangle x="111" y="160" width="40" height="80" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="249" value="Stokes I" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;" parent="248" vertex="1">
<mxGeometry x="40" y="12" width="130" height="60" as="geometry"/>
</mxCell>
<mxCell id="250" value="Stokes Q" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;" parent="248" vertex="1">
<mxGeometry x="201" y="12" width="130" height="60" as="geometry"/>
</mxCell>
<mxCell id="251" value="Stokes U" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;" parent="248" vertex="1">
<mxGeometry x="363" y="12" width="130" height="60" as="geometry"/>
</mxCell>
<mxCell id="253" value="Stokes IQU covariance" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;shadow=0;sketch=0;fillColor=default;flipH=1;size=10;" parent="248" vertex="1">
<mxGeometry x="519" y="5" width="140" height="68.8975" as="geometry"/>
</mxCell>
<mxCell id="266" value="See Section 2.7 for computation" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;shadow=0;sketch=0;" parent="248" vertex="1">
<mxGeometry x="30" y="74" width="640" height="30" as="geometry"/>
</mxCell>
<mxCell id="256" value="Compute Stoke" style="html=1;shadow=0;dashed=0;align=center;verticalAlign=middle;shape=mxgraph.arrows2.arrow;dy=0;dx=10;notch=0;sketch=0;fillColor=default;" parent="1" vertex="1">
<mxGeometry x="10" y="547" width="130" height="17.7165" as="geometry"/>
</mxCell>
<mxCell id="282" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;elbow=vertical;" parent="1" source="268" target="276" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="268" value="Rotated Stokes" style="swimlane;horizontal=0;whiteSpace=wrap;html=1;container=0;" parent="1" vertex="1">
<mxGeometry x="120" y="693" width="680" height="90" as="geometry">
<mxRectangle x="111" y="160" width="40" height="80" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="269" value="Stokes I" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;" parent="268" vertex="1">
<mxGeometry x="40" y="15" width="130" height="60" as="geometry"/>
</mxCell>
<mxCell id="270" value="Stokes Q" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;" parent="268" vertex="1">
<mxGeometry x="201" y="15" width="130" height="60" as="geometry"/>
</mxCell>
<mxCell id="271" value="Stokes U" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;" parent="268" vertex="1">
<mxGeometry x="363" y="15" width="130" height="60" as="geometry"/>
</mxCell>
<mxCell id="272" value="Stokes IQU covariance" style="shape=cube;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;darkOpacity=0.05;darkOpacity2=0.1;shadow=0;sketch=0;fillColor=default;flipH=1;size=10;" parent="268" vertex="1">
<mxGeometry x="519" y="8.551250000000003" width="140" height="68.8975" as="geometry"/>
</mxCell>
<mxCell id="275" value="Rotate Stoke" style="html=1;shadow=0;dashed=0;align=center;verticalAlign=middle;shape=mxgraph.arrows2.arrow;dy=0;dx=10;notch=0;sketch=0;fillColor=default;" parent="1" vertex="1">
<mxGeometry x="10" y="673" width="130" height="17.7165" as="geometry"/>
</mxCell>
<mxCell id="276" value="Polarization Parameters" style="swimlane;horizontal=0;whiteSpace=wrap;html=1;container=0;" parent="1" vertex="1">
<mxGeometry x="120" y="807" width="680" height="93" as="geometry">
<mxRectangle x="111" y="160" width="40" height="80" as="alternateBounds"/>
</mxGeometry>
</mxCell>
<mxCell id="277" value="Debiased Polarization Degree" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;" parent="276" vertex="1">
<mxGeometry x="40" y="9" width="130" height="60" as="geometry"/>
</mxCell>
<mxCell id="278" value="Polarization Angle" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;" parent="276" vertex="1">
<mxGeometry x="203" y="9" width="130" height="60" as="geometry"/>
</mxCell>
<mxCell id="279" value="Polarized Flux" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;" parent="276" vertex="1">
<mxGeometry x="367" y="9" width="130" height="60" as="geometry"/>
</mxCell>
<mxCell id="281" value="Polarization Degree Uncertainty" style="rounded=0;whiteSpace=wrap;html=1;shadow=0;sketch=0;fillColor=default;" parent="276" vertex="1">
<mxGeometry x="530" y="9" width="130" height="60" as="geometry"/>
</mxCell>
<mxCell id="291" value="See Section 2.7 for computation" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;shadow=0;sketch=0;" parent="276" vertex="1">
<mxGeometry x="30" y="69" width="640" height="30" as="geometry"/>
</mxCell>
<mxCell id="283" value="Compute Polarization" style="html=1;shadow=0;dashed=0;align=center;verticalAlign=middle;shape=mxgraph.arrows2.arrow;dy=0;dx=10;notch=0;sketch=0;fillColor=default;" parent="1" vertex="1">
<mxGeometry x="10" y="786" width="130" height="17.7165" as="geometry"/>
</mxCell>
<mxCell id="136" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.483;entryY=0.188;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="13" target="4" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="137" style="edgeStyle=elbowEdgeStyle;elbow=vertical;html=1;entryX=0.475;entryY=0.188;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="13" target="35" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="240" style="edgeStyle=orthogonalEdgeStyle;html=1;entryX=0.521;entryY=0.188;entryDx=0;entryDy=0;entryPerimeter=0;elbow=vertical;" parent="1" source="13" target="26" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
<mxCell id="284" value="Compute maximal or minimal convex hull for all images" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;shadow=0;sketch=0;fontSize=10;labelPosition=center;verticalLabelPosition=middle;spacing=0;spacingTop=-2;" parent="1" vertex="1">
<mxGeometry x="10" y="200" width="110" height="50" as="geometry"/>
</mxCell>
<mxCell id="285" value="Compute and subtract mean value of the Gaussian-fitted intensity histogram and compute first order uncertainties" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;shadow=0;sketch=0;fontSize=10;labelPosition=center;verticalLabelPosition=middle;spacing=0;spacingTop=-2;" parent="1" vertex="1">
<mxGeometry x="10" y="292.72" width="110" height="67.28" as="geometry"/>
</mxCell>
<mxCell id="286" value="Aligned background subtracted images using cross-correlation and propagate uncertainties through image displacement" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;shadow=0;sketch=0;fontSize=10;labelPosition=center;verticalLabelPosition=middle;spacing=0;spacingTop=-2;" parent="1" vertex="1">
<mxGeometry x="10" y="386.72" width="110" height="73.28" as="geometry"/>
</mxCell>
<mxCell id="287" value="Combine multiple observations through same filter with weighted gaussian smoothing" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;shadow=0;sketch=0;fontSize=10;spacing=0;spacingTop=-2;" parent="1" vertex="1">
<mxGeometry x="10" y="483.72" width="110" height="56.28" as="geometry"/>
</mxCell>
<mxCell id="289" value="Rotate computed Stokes parameters and uncertainties to have North up" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;shadow=0;sketch=0;fontSize=10;spacing=0;spacingTop=-2;" parent="1" vertex="1">
<mxGeometry x="10" y="690.72" width="110" height="82.28" as="geometry"/>
</mxCell>
<mxCell id="290" value="Compute polarization parameters from the rotated Stokes parameters and uncertainties" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;shadow=0;sketch=0;fontSize=10;spacing=0;spacingTop=-2;" parent="1" vertex="1">
<mxGeometry x="10" y="803.72" width="110" height="79.28" as="geometry"/>
</mxCell>
<mxCell id="292" value="Compute the Stokes parameters and uncertainties from the combined images and uncertainties and propagate polarizer axis uncertainty" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;shadow=0;sketch=0;fontSize=10;spacing=0;spacingTop=-2;" parent="1" vertex="1">
<mxGeometry x="10" y="564.72" width="110" height="105.28" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 201 KiB

11288
pipeline.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 407 KiB

View File

@@ -5,117 +5,16 @@ Main script where are progressively added the steps for the FOC pipeline reducti
"""
#Project libraries
import sys
import numpy as np
from copy import deepcopy
import lib.fits as proj_fits #Functions to handle fits files
import lib.reduction as proj_red #Functions used in reduction pipeline
import lib.plots as proj_plots #Functions for plotting data
from lib.convex_hull import image_hull
from lib.deconvolve import from_file_psf
import matplotlib.pyplot as plt
from astropy.wcs import WCS
##### User inputs
## Input and output locations
globals()['data_folder'] = "../data/NGC1068_x274020/"
globals()['infiles'] = ['x274020at_c0f.fits','x274020bt_c0f.fits','x274020ct_c0f.fits',
'x274020dt_c0f.fits','x274020et_c0f.fits','x274020ft_c0f.fits',
'x274020gt_c0f.fits','x274020ht_c0f.fits','x274020it_c0f.fits']
#psf_file = 'NGC1068_f253m00.fits'
globals()['plots_folder'] = "../plots/NGC1068_x274020/"
#globals()['data_folder'] = "../data/IC5063_x3nl030/"
#globals()['infiles'] = ['x3nl0301r_c0f.fits','x3nl0302r_c0f.fits','x3nl0303r_c0f.fits']
##psf_file = 'IC5063_f502m00.fits'
#globals()['plots_folder'] = "../plots/IC5063_x3nl030/"
#globals()['data_folder'] = "../data/NGC1068_x14w010/"
#globals()['infiles'] = ['x14w0101t_c0f.fits','x14w0102t_c0f.fits','x14w0103t_c0f.fits',
# 'x14w0104t_c0f.fits','x14w0105p_c0f.fits','x14w0106t_c0f.fits']
#globals()['plots_folder'] = "../plots/NGC1068_x14w010/"
#globals()['data_folder'] = "../data/3C405_x136060/"
#globals()['infiles'] = ['x1360601t_c0f.fits','x1360602t_c0f.fits','x1360603t_c0f.fits']
#globals()['plots_folder'] = "../plots/3C405_x136060/"
#globals()['data_folder'] = "../data/CygnusA_x43w0/"
#globals()['infiles'] = ['x43w0101r_c0f.fits', 'x43w0102r_c0f.fits', 'x43w0103r_c0f.fits',
# 'x43w0104r_c0f.fits', 'x43w0105r_c0f.fits', 'x43w0106r_c0f.fits',
# 'x43w0107r_c0f.fits', 'x43w0108r_c0f.fits', 'x43w0109r_c0f.fits'] #F342W
##globals()['infiles'] = ['x43w0201r_c0f.fits', 'x43w0202r_c0f.fits', 'x43w0203r_c0f.fits',
## 'x43w0204r_c0f.fits', 'x43w0205r_c0f.fits', 'x43w0206r_c0f.fits'] #F275W
#globals()['plots_folder'] = "../plots/CygnusA_x43w0/"
#globals()['data_folder'] = "../data/3C109_x3mc010/"
#globals()['infiles'] = ['x3mc0101m_c0f.fits','x3mc0102m_c0f.fits','x3mc0103m_c0f.fits']
#globals()['plots_folder'] = "../plots/3C109_x3mc010/"
#globals()['data_folder'] = "../data/MKN463_x2rp030/"
#globals()['infiles'] = ['x2rp0201t_c0f.fits', 'x2rp0202t_c0f.fits', 'x2rp0203t_c0f.fits',
# 'x2rp0204t_c0f.fits', 'x2rp0205t_c0f.fits', 'x2rp0206t_c0f.fits',
# 'x2rp0207t_c0f.fits', 'x2rp0301t_c0f.fits', 'x2rp0302t_c0f.fits',
# 'x2rp0303t_c0f.fits', 'x2rp0304t_c0f.fits', 'x2rp0305t_c0f.fits',
# 'x2rp0306t_c0f.fits', 'x2rp0307t_c0f.fits']
#globals()['plots_folder'] = "../plots/MKN463_x2rp030/"
#globals()['data_folder'] = "../data/PG1630+377_x39510/"
#globals()['infiles'] = ['x3990201m_c0f.fits', 'x3990205m_c0f.fits', 'x3995101r_c0f.fits',
# 'x3995105r_c0f.fits', 'x3995109r_c0f.fits', 'x3995201r_c0f.fits',
# 'x3995205r_c0f.fits', 'x3990202m_c0f.fits', 'x3990206m_c0f.fits',
# 'x3995102r_c0f.fits', 'x3995106r_c0f.fits', 'x399510ar_c0f.fits',
# 'x3995202r_c0f.fits','x3995206r_c0f.fits']
#globals()['plots_folder'] = "../plots/PG1630+377_x39510/"
#globals()['data_folder'] = "../data/MKN3_x3nl010/"
#globals()['infiles'] = ['x3nl0101r_c0f.fits','x3nl0102r_c0f.fits','x3nl0103r_c0f.fits']
#globals()['plots_folder'] = "../plots/MKN3_x3nl010/"
#globals()['data_folder'] = "../data/MKN3_x3md010/"
#globals()['infiles'] = ['x3md0101r_c0f.fits', 'x3md0102r_c0f.fits', 'x3md0103r_c0f.fits'] #F275W
##globals()['infiles'] = ['x3md0104r_c0f.fits', 'x3md0105r_c0f.fits', 'x3md0106r_c0f.fits'] #F342W
#globals()['plots_folder'] = "../plots/MKN3_x3md010/"
#globals()['data_folder'] = "../data/MKN78_x3nl020/"
#globals()['infiles'] = ['x3nl0201r_c0f.fits','x3nl0202r_c0f.fits','x3nl0203r_c0f.fits']
#globals()['plots_folder'] = "../plots/MKN78_x3nl020/"
#globals()['data_folder'] = "../data/MRK231_x4qr010/"
#globals()['infiles'] = ['x4qr010ar_c0f.fits', 'x4qr010br_c0f.fits', 'x4qr010dr_c0f.fits',
# 'x4qr010er_c0f.fits', 'x4qr010gr_c0f.fits', 'x4qr010hr_c0f.fits',
# 'x4qr010jr_c0f.fits', 'x4qr010kr_c0f.fits', 'x4qr0104r_c0f.fits',
# 'x4qr0105r_c0f.fits', 'x4qr0107r_c0f.fits', 'x4qr0108r_c0f.fits']
#globals()['plots_folder'] = "../plots/MRK231_x4qr010/"
#globals()['data_folder'] = "../data/3C273_x0u20/"
#globals()['infiles'] = ['x0u20101t_c0f.fits','x0u20102t_c0f.fits','x0u20103t_c0f.fits',
# 'x0u20104t_c0f.fits','x0u20105t_c0f.fits','x0u20106t_c0f.fits',
# 'x0u20201t_c0f.fits','x0u20202t_c0f.fits','x0u20203t_c0f.fits',
# 'x0u20204t_c0f.fits','x0u20205t_c0f.fits','x0u20206t_c0f.fits',
# 'x0u20301t_c0f.fits','x0u20302t_c0f.fits','x0u20303t_c0f.fits',
# 'x0u20304t_c0f.fits','x0u20305t_c0f.fits','x0u20306t_c0f.fits']
#globals()['plots_folder'] = "../plots/3C273_x0u20/"
#BEWARE: 5 observations separated by 1 year each (1995, 1996, 1997, 1998, 1999)
#globals()['data_folder'] = "../data/M87/POS1/"
##globals()['infiles'] = ['x2py010ct_c0f.fits','x2py010dt_c0f.fits','x2py010et_c0f.fits','x2py010ft_c0f.fits'] #1995
##globals()['infiles'] = ['x3be010ct_c0f.fits','x3be010dt_c0f.fits','x3be010et_c0f.fits','x3be010ft_c0f.fits'] #1996
##globals()['infiles'] = ['x43r010km_c0f.fits','x43r010mm_c0f.fits','x43r010om_c0f.fits','x43r010rm_c0f.fits'] #1997
##globals()['infiles'] = ['x43r110kr_c0f.fits','x43r110mr_c0f.fits','x43r110or_c0f.fits','x43r110rr_c0f.fits'] #1998
#globals()['infiles'] = ['x43r210kr_c0f.fits','x43r210mr_c0f.fits','x43r210or_c0f.fits','x43r210rr_c0f.fits'] #1999
#globals()['plots_folder'] = "../plots/M87/POS1/"
#BEWARE: 5 observations separated by 1 year each (1995, 1996, 1997, 1998, 1999)
#globals()['data_folder'] = "../data/M87/POS3/"
##globals()['infiles'] = ['x2py030at_c0f.fits','x2py030bt_c0f.fits','x2py030ct_c0f.fits','x2py0309t_c0f.fits'] #1995
##globals()['infiles'] = ['x3be030at_c0f.fits','x3be030bt_c0f.fits','x3be030ct_c0f.fits','x3be0309t_c0f.fits'] #1996
##globals()['infiles'] = ['x43r030em_c0f.fits','x43r030gm_c0f.fits','x43r030im_c0f.fits','x43r030lm_c0f.fits'] #1997
##globals()['infiles'] = ['x43r130er_c0f.fits','x43r130fr_c0f.fits','x43r130ir_c0f.fits','x43r130lr_c0f.fits'] #1998
#globals()['infiles'] = ['x43r230er_c0f.fits','x43r230fr_c0f.fits','x43r230ir_c0f.fits','x43r230lr_c0f.fits'] #1999
#globals()['plots_folder'] = "../plots/M87/POS3/"
from lib.query import retrieve_products
def main():
def main(target=None, proposal_id=None, infiles=None):
## Reduction parameters
# Deconvolution
deconvolve = False
@@ -127,35 +26,41 @@ def main():
psf_shape=(25,25)
iterations = 5
algo="richardson"
# Initial crop
display_crop = True
# Error estimation
error_sub_type = (51,51)#'freedman-diaconis' #sqrt, sturges, rice, scott, freedman-diaconis (default) or shape (example (51,51))
display_crop = False
# Background estimation
error_sub_type = 'freedman-diaconis' #sqrt, sturges, rice, scott, freedman-diaconis (default) or shape (example (51,51))
subtract_error = 1.25
display_error = True
display_error = False
# Data binning
rebin = True
pxsize = 0.10
px_scale = 'arcsec' #pixel, arcsec or full
rebin_operation = 'sum' #sum or average
# Alignement
align_center = 'image' #If None will align image to image center
display_data = True
display_data = False
# Smoothing
smoothing_function = 'combine' #gaussian_after, weighted_gaussian_after, gaussian, weighted_gaussian or combine
smoothing_FWHM = 0.20 #If None, no smoothing is done
smoothing_scale = 'arcsec' #pixel or arcsec
# Rotation
rotate_stokes = True
rotate_data = False #rotation to North convention can give erroneous results
# Final crop
crop = False #Crop to desired ROI
final_display = True
final_display = False #Whether to display all polarization map outputs
# Polarization map output
figname = 'NGC1068_FOC' #target/intrument name
figtype = '_c_020' #additionnal informations
SNRp_cut = 5. #P measurments with SNR>3
SNRi_cut = 50. #I measurments with SNR>30, which implies an uncertainty in P of 4.7%.
SNRp_cut = 3. #P measurments with SNR>3
SNRi_cut = 30. #I measurments with SNR>30, which implies an uncertainty in P of 4.7%.
vec_scale = 2.0
step_vec = 1 #plot all vectors in the array. if step_vec = 2, then every other vector will be plotted
# if step_vec = 0 then all vectors are displayed at full length
@@ -163,8 +68,21 @@ def main():
##### Pipeline start
## Step 1:
# Get data from fits files and translate to flux in erg/cm²/s/Angstrom.
if not infiles is None:
products = [np.array([["/".join(filepath.split('/')[:-1]),filepath.split('/')[-1]] for filepath in infiles],dtype=str)]
else:
products = retrieve_products(target,proposal_id)
data_folder = products[0][0,0]
try:
plots_folder = data_folder.replace("data","plots")
except:
plots_folder = "."
infiles = products[0][:,1]
data_array, headers = proj_fits.get_obs_data(infiles, data_folder=data_folder, compute_flux=True)
figname = "_".join([target,"FOC"])
figtype = "_".join(["".join([s[0] for s in smoothing_function.split("_")]),str(smoothing_FWHM).replace(".","")]) #additionnal informations
# Crop data to remove outside blank margins.
data_array, error_array, headers = proj_red.crop_array(data_array, headers, step=5, null_val=0., inside=True, display=display_crop, savename=figname, plots_folder=plots_folder)
@@ -191,11 +109,7 @@ def main():
#Plot array for checking output
if display_data and px_scale.lower() not in ['full','integrate']:
vertex = image_hull(data_mask,step=5,null_val=0.,inside=True)
shape = np.array([vertex[1]-vertex[0],vertex[3]-vertex[2]])
rectangle = [vertex[2], vertex[0], shape[1], shape[0], 0., 'g']
proj_plots.plot_obs(data_array, headers, vmin=data_array[data_array>0.].min()*headers[0]['photflam'], vmax=data_array[data_array>0.].max()*headers[0]['photflam'], rectangle =[rectangle,]*data_array.shape[0], savename=figname+"_center_"+align_center, plots_folder=plots_folder)
proj_plots.plot_obs(data_array, headers, vmin=data_array[data_array>0.].min()*headers[0]['photflam'], vmax=data_array[data_array>0.].max()*headers[0]['photflam'], savename=figname+"_center_"+align_center, plots_folder=plots_folder)
background = np.array([np.array(bkg).reshape(1,1) for bkg in background])
background_error = np.array([np.array(np.sqrt((bkg-background[np.array([h['filtnam1']==head['filtnam1'] for h in headers],dtype=bool)].mean())**2/np.sum([h['filtnam1']==head['filtnam1'] for h in headers]))).reshape(1,1) for bkg,head in zip(background,headers)])
@@ -258,5 +172,17 @@ def main():
return 0
if __name__ == "__main__":
sys.exit(main())
import argparse
parser = argparse.ArgumentParser(description='Query MAST for target products')
parser.add_argument('-t','--target', metavar='targetname', required=False,
help='the name of the target', type=str, default=None)
parser.add_argument('-p','--proposal_id', metavar='proposal_id', required=False,
help='the proposal id of the data products', type=int, default=None)
parser.add_argument('-f','--files', metavar='path', required=False, nargs='*',
help='the full or relative path to the data products', default=None)
args = parser.parse_args()
prodpaths = main(target=args.target, proposal_id=args.proposal_id, infiles=args.files)
print(prodpaths)

View File

@@ -19,6 +19,7 @@ root_dir_S = path_join(root_dir,'FOC_Reduction','output')
root_dir_data_S = path_join(root_dir,'FOC_Reduction','data','NGC1068_x274020')
root_dir_plot_S = path_join(root_dir,'FOC_Reduction','plots','NGC1068_x274020')
filename_S = "NGC1068_FOC_b_10px.fits"
plt.rcParams.update({'font.size': 15})
data_K = {}
data_S = {}
@@ -107,7 +108,6 @@ fig_pa.savefig(path_join(root_dir_plot_S,"NGC1068_K_pol_ang.png"),bbox_inches="t
#####
###display both polarization maps to check consistency
#####
plt.rcParams.update({'font.size': 10})
fig = plt.figure(num="Polarization maps comparison")
ax = fig.add_subplot(111, projection=wcs)
fig.subplots_adjust(right=0.85)
@@ -132,7 +132,7 @@ ax.coords[1].set_ticklabel_position('l')
#ax.axis('equal')
cbar = plt.colorbar(im0, cax=cbar_ax, label=r"$F_{\lambda}$ [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]")
plt.rcParams.update({'font.size': 8})
#plt.rcParams.update({'font.size': 8})
ax.legend(loc='upper right')
fig.savefig(path_join(root_dir_plot_S,"NGC1068_K_comparison.png"),bbox_inches="tight")

View File

@@ -10,6 +10,7 @@ prototypes :
Compute the error (noise) of the input array by looking at the sub-region of minimal flux in every image and of shape sub_shape.
"""
import sys
from os.path import join as path_join
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
@@ -59,7 +60,7 @@ def display_bkg(data, background, std_bkg, headers, histograms=None, binning=Non
ax.set_ylabel(r"Flux [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]")
plt.legend()
if not(savename is None):
fig.savefig(plots_folder+savename+"_background_flux.png", bbox_inches='tight')
fig.savefig(path_join(plots_folder,savename+"_background_flux.png"), bbox_inches='tight')
if not(histograms is None):
filt_obs = {"POL0":0, "POL60":0, "POL120":0}
@@ -78,7 +79,7 @@ def display_bkg(data, background, std_bkg, headers, histograms=None, binning=Non
ax_h.set_title("Histogram for each observation")
plt.legend()
if not(savename is None):
fig_h.savefig(plots_folder+savename+'_histograms.png', bbox_inches='tight')
fig_h.savefig(path_join(plots_folder,savename+'_histograms.png'), bbox_inches='tight')
fig2, ax2 = plt.subplots(figsize=(10,10))
data0 = data[0]*convert_flux[0]
@@ -103,7 +104,7 @@ def display_bkg(data, background, std_bkg, headers, histograms=None, binning=Non
fig2.colorbar(im, cax=cbar_ax, label=r"Flux [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]")
if not(savename is None):
fig2.savefig(plots_folder+savename+'_'+filt+'_background_location.png', bbox_inches='tight')
fig2.savefig(path_join(plots_folder,savename+'_'+filt+'_background_location.png'), bbox_inches='tight')
if not(rectangle is None):
plot_obs(data, headers, vmin=data[data > 0.].min()*convert_flux.mean(), vmax=data[data > 0.].max()*convert_flux.mean(), rectangle=rectangle,
savename=savename+"_background_location",plots_folder=plots_folder)

View File

@@ -10,6 +10,7 @@ prototypes :
"""
import numpy as np
from os.path import join as path_join
from astropy.io import fits
from astropy import wcs
from lib.convex_hull import image_hull, clean_ROI
@@ -39,7 +40,7 @@ def get_obs_data(infiles, data_folder="", compute_flux=False):
"""
data_array, headers = [], []
for i in range(len(infiles)):
with fits.open(data_folder+infiles[i]) as f:
with fits.open(path_join(data_folder,infiles[i])) as f:
headers.append(f[0].header)
data_array.append(f[0].data)
data_array = np.array(data_array,dtype=np.double)
@@ -188,7 +189,7 @@ def save_Stokes(I_stokes, Q_stokes, U_stokes, Stokes_cov, P, debiased_P, s_P,
hdul.append(hdu)
#Save fits file to designated filepath
hdul.writeto(data_folder+filename+".fits", overwrite=True)
hdul.writeto(path_join(data_folder,filename+".fits"), overwrite=True)
if return_hdul:
return hdul

View File

@@ -38,6 +38,7 @@ prototypes :
from copy import deepcopy
import numpy as np
from os.path import join as path_join
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle, Circle
from matplotlib.path import Path
@@ -161,7 +162,7 @@ def plot_obs(data_array, headers, shape=None, vmin=None, vmax=None, rectangle=No
if not (savename is None):
#fig.suptitle(savename)
fig.savefig(plots_folder+savename+".png",bbox_inches='tight')
fig.savefig(path_join(plots_folder,savename+".png"),bbox_inches='tight')
plt.show()
return 0
@@ -211,7 +212,7 @@ def plot_Stokes(Stokes, savename=None, plots_folder=""):
if not (savename is None):
#fig.suptitle(savename+"_IQU")
fig.savefig(plots_folder+savename+"_IQU.png",bbox_inches='tight')
fig.savefig(path_join(plots_folder,savename+"_IQU.png"),bbox_inches='tight')
plt.show()
return 0
@@ -320,7 +321,7 @@ def polarization_map(Stokes, data_mask=None, rectangle=None, SNRp_cut=3., SNRi_c
if display.lower() in ['intensity']:
# If no display selected, show intensity map
display='i'
vmin, vmax = 1.*np.mean(np.sqrt(stk_cov.data[0,0][mask])*convert_flux), np.max(stkI.data[stkI.data > 0.]*convert_flux)
vmin, vmax = 1/5.0*np.mean(np.sqrt(stk_cov.data[0,0][mask])*convert_flux), np.max(stkI.data[stkI.data > 0.]*convert_flux)
im = ax.imshow(stkI.data*convert_flux, norm=LogNorm(vmin,vmax), aspect='equal', cmap='inferno', alpha=1.)
cbar = plt.colorbar(im, cax=cbar_ax, label=r"$F_{\lambda}$ [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]")
levelsI = np.linspace(vmax*0.01, vmax*0.99, 10)
@@ -446,7 +447,7 @@ def polarization_map(Stokes, data_mask=None, rectangle=None, SNRp_cut=3., SNRi_c
if not savename is None:
#fig.suptitle(savename)
fig.savefig(plots_folder+savename+".png",bbox_inches='tight',dpi=300)
fig.savefig(path_join(plots_folder,savename+".png"),bbox_inches='tight',dpi=300)
plt.show()
return fig, ax
@@ -1766,7 +1767,7 @@ class pol_map(object):
self.display_selection = "total_flux"
if self.display_selection.lower() in ['total_flux']:
self.data = self.I*self.convert_flux
vmin, vmax = 1/2.0*np.median(self.data[self.data > 0.]), np.max(self.data[self.data > 0.])
vmin, vmax = 1/5.0*np.median(self.data[self.data > 0.]), np.max(self.data[self.data > 0.])
norm = LogNorm(vmin, vmax)
label = r"$F_{\lambda}$ [$ergs \cdot cm^{-2} \cdot s^{-1} \cdot \AA^{-1}$]"
elif self.display_selection.lower() in ['pol_flux']:

View File

@@ -1,5 +1,3 @@
from sys import exit as sys_exit, argv as sys_argv
from getopt import getopt, error as geterr
from os import system
from os.path import join as path_join, exists as path_exists
from astroquery.mast import MastMissions, Observations
@@ -102,10 +100,11 @@ def get_product_list(target, proposal_id=None):
return products
def retrieve_products(target, products):
def retrieve_products(target, proposal_id=None):
"""
Given a target name and a products list, create the local directories and retrieve the fits files from the MAST Archive
Given a target name and a proposal_id, create the local directories and retrieve the fits files from the MAST Archive
"""
products = get_product_list(target=target,proposal_id=proposal_id)
prodpaths = []
data_dir = path_join("../data", target)
out = ""
@@ -113,7 +112,7 @@ def retrieve_products(target, products):
filepaths = []
obs_dir = path_join(data_dir, obs_id)
if not path_exists(obs_dir):
system("mkdir -p "+obs_dir)
system("mkdir -p {0:s} {1:s}".format(obs_dir,path_join("../plots",target,obs_id)))
for file in products['productFilename'][products['proposal_id'] == obs_id]:
fpath = path_join(obs_dir, file)
if not path_exists(fpath):
@@ -121,37 +120,20 @@ def retrieve_products(target, products):
products['dataURI'][products['productFilename'] == file][0], local_path=fpath)[0])
else:
out += "{0:s} : Exists\n".format(file)
filepaths.append(fpath)
prodpaths.append(filepaths)
filepaths.append([obs_dir,file])
prodpaths.append(np.array(filepaths,dtype=str))
return prodpaths
def main():
target, proposal_id = None, None
try:
arg, _ = getopt(sys_argv[1:], "ht:p:", ["help", "target=", "proposal_id="])
for curr_arg, curr_val in arg:
if curr_arg in ("-h", "--help"):
print("python3 query.py -t <target_name> -p <proposal_id>")
elif curr_arg in ("-t", "--target"):
target = str(curr_val)
elif curr_arg in ("-p", "--proposal_id"):
proposal_id = int(curr_val)
except geterr:
print(str(geterr))
if target is None:
target = input("Target name\n>")
products = get_product_list(target=target,proposal_id=proposal_id)
products_paths = retrieve_products(target=target, products=products)
print(products_paths)
return 0
if __name__ == "__main__":
sys_exit(main())
import argparse
parser = argparse.ArgumentParser(description='Query MAST for target products')
parser.add_argument('-t','--target', metavar='targetname', required=False,
help='the name of the target', type=str, default=None)
parser.add_argument('-p','--proposal_id', metavar='proposal_id', required=False,
help='the proposal id of the data products', type=int, default=None)
args = parser.parse_args()
prodpaths = retrieve_products(target=args.target, proposal_id=args.proposal_id)
print(prodpaths)

View File

@@ -1,8 +0,0 @@
EXECUTER PIPELINE
python3 FOC_reduction.py
OUVRIR LE FICHIER FITS FINAL AVEC L'OUTIL D'ANALYSE
python3 analysis.py -f ../data/NGC1068_x274020/NGC1068_FOC_combine_FWHM010.fits
METTRE DES VALEURS PAR DEFAUT A L'OUTIL D'ANALYSE POUR LES CUTS EN POLARIZATION ET INTENSITE
python3 analysis.py -f ../data/NGC1068_x274020/NGC1068_FOC_combine_FWHM010.fits -p 5 -i 10

View File

@@ -1,14 +0,0 @@
RECUPERER NOUVELLE VERSION
git fetch
INSTALLER NOUVELLE VERSION
git pull origin main
AJOUTER TOUS LES FICHIERS A L'ARBRE DE DIFFERENTIATION DU GIT
git add .
PRENDRE TOUS LES FICHIERS DE L'ARBRE COURANT POUR EN FAIRE UNE VERSION
git commit -m "mesage du commit"
ENVOYER MES COMMITS LOCAUX AU DOSSIER PARTAGE DISTANT
git push -u origin main