Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #76 from robelgeda/master
Browse files Browse the repository at this point in the history
Cutout Tool and Flag+Comment Boxes
  • Loading branch information
nmearl authored Sep 11, 2017
2 parents 5347ba4 + fefb391 commit d9ceb81
Show file tree
Hide file tree
Showing 8 changed files with 1,586 additions and 21 deletions.
3 changes: 2 additions & 1 deletion mosviz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
def setup():
from .viewers.mos_viewer import MOSVizViewer
from glue.config import qt_client

from .plugins.cutout_tool import nIRSpec_cutout_tool
from .plugins.table_generator import nIRSpec_table_gen
qt_client.add(MOSVizViewer)


Expand Down
209 changes: 209 additions & 0 deletions mosviz/data/ui/cutout_tool.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>621</width>
<height>470</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>621</width>
<height>470</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>621</width>
<height>470</height>
</size>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="1" colspan="4">
<widget class="QLineEdit" name="inImage"/>
</item>
<item row="6" column="1">
<widget class="QLabel" name="label_6">
<property name="text">
<string>X:</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Y:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string> Path to Image:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string> Cutout size in arcsec:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string> Save cutouts at:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="4">
<widget class="QLineEdit" name="inSpectra"/>
</item>
<item row="4" column="1" colspan="4">
<widget class="QLineEdit" name="inSave">
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
</property>
</widget>
</item>
<item row="9" column="5">
<widget class="QPushButton" name="start">
<property name="text">
<string>Start</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0" colspan="6">
<widget class="QTextBrowser" name="infoBox">
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 203);</string>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::FixedPixelWidth</enum>
</property>
<property name="lineWrapColumnOrWidth">
<number>585</number>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:14pt; font-weight:600; text-decoration: underline;&quot;&gt;Cutout Tool for JWST/NIRSpec MSA Programs&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;MOSViz is a quick-look analysis and visualization tool for multi-object spectroscopy (MOS). It is designed to work with JWST and non-JWST data: spectra and it can be used with associated images. MOSViz can display a “postage stamp” image of the source along with the spectra. These images are usually cutouts from larger images. The MOSViz Cutout Tool for JWST/NIRSpec MSA Programs uses information in the headers of NIRSpec spectra files to generate cutouts. MOSViz uses a special catalog called a MOSViz Table to organize file paths and information. The Cutout Tool will generate a MOSViz Table after the cutouts are saved.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Inputs&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;NIRSpec spectra directory: &lt;/span&gt;This is the path to the NIRSpec MSA post-pipeline spectra. These files are saved in the level3 subdirectory of the pipeline output. The files should follow the following naming scheme:&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;&amp;lt;programName&amp;gt;_&amp;lt;objectName&amp;gt;_&amp;lt;instrument_filter&amp;gt;_ &amp;lt;grating&amp;gt;_&amp;lt;s2d|x1d&amp;gt;.fits&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Image:&lt;/span&gt; An image to make cutouts from. You can use NIRCam images as well as images from other sources. If a target's coordinates are out of range, that target will not be assigned a cutout. A list of skipped files will be saved in a text file at the save destination.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a name=&quot;docs-internal-guid-c8f1413b-5cd0-ce16-af7d-b5b1a747d2df&quot;&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Arial'; font-weight:600; color:#000000; background-color:transparent;&quot;&gt;C&lt;/span&gt;&lt;span style=&quot; font-family:'Arial'; font-weight:600; color:#000000; background-color:transparent;&quot;&gt;utout Size:&lt;/span&gt;&lt;span style=&quot; font-family:'Arial'; color:#000000; background-color:transparent;&quot;&gt; The size of individual cutouts in arcsec&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; color:#000000;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-weight:600; color:#000000; background-color:transparent;&quot;&gt;Save Path (Optional):&lt;/span&gt;&lt;span style=&quot; font-family:'Arial'; color:#000000; background-color:transparent;&quot;&gt; The Cutout Tool saves a subdirectory of cutouts and a MOSViz Table in the same directory as the spectra files by default. You can change the save destination of these items by clicking the &amp;quot;Change&amp;quot; button. Changing the save destination will generate a MOSViz Table that is unique to your computer (you will not be able to share it).&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; color:#000000;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-weight:600; color:#000000; background-color:transparent;&quot;&gt;Outputs&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-weight:600; color:#000000; background-color:transparent;&quot;&gt;Cutouts: &lt;/span&gt;&lt;span style=&quot; font-family:'Arial'; color:#000000; background-color:transparent;&quot;&gt;A directory containing cutouts. The cutout images will follow the naming scheme:&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a name=&quot;docs-internal-guid-c8f1413b-5cd1-dca8-4611-362810d62030&quot;&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Arial'; font-style:italic; color:#000000; background-color:transparent;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot; font-family:'Arial'; font-style:italic; color:#000000; background-color:transparent;&quot;&gt;objectName&amp;gt;_&amp;lt;programName&amp;gt;_cutout.fits&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; color:#000000;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-weight:600; color:#000000;&quot;&gt;MOSViz Table: &lt;/span&gt;&lt;span style=&quot; font-family:'Arial'; color:#000000;&quot;&gt;A table containing paths to MSA spectra and cutout images. The MOSViz Table file will be saved in ASCII-Ecsv format. You can import this file into glue and visualize your data using MOSViz. Information contained in the MOSViz Table:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- Object ID. &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- Right Ascension. &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- Declination. &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- Path to 1d spectrum file. &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- Path to 2d spectrum file. &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- Path to cutout file, “None” otherwise. &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- Slit width and length. &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;- Pixel scale.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="9" column="1" colspan="4">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLineEdit" name="xSize"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string> Path to spectra directory:</string>
</property>
</widget>
</item>
<item row="4" column="5">
<widget class="QPushButton" name="savePathButton">
<property name="text">
<string>Change</string>
</property>
</widget>
</item>
<item row="3" column="5">
<widget class="QPushButton" name="imageBrowseButton">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string> Progress:</string>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QPushButton" name="specBrowseButton">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QLineEdit" name="ySize"/>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="table_checkBox">
<property name="text">
<string>Generate MOSViz Table</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>621</width>
<height>22</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>
Loading

0 comments on commit d9ceb81

Please sign in to comment.