<!-- 
RSS generated by JIRA (8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b) at Sat Feb 10 15:34:44 JST 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>PFS-JIRA</title>
    <link>https://pfspipe.ipmu.jp/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.3.4</version>
        <build-number>803005</build-number>
        <build-date>13-09-2019</build-date>
    </build-info>


<item>
            <title>[DAMD-145] Add facility to hold history/metrics of spectra</title>
                <link>https://pfspipe.ipmu.jp/jira/browse/DAMD-145</link>
                <project id="10400" key="DAMD">Data Model</project>
                    <description>&lt;p&gt;We need a facility to allow us to track corrections to and problems with individual spectra. We want to be able to store values (e.g., blackspot correction of 10%) in addition to flags (e.g., aperture correction failed). This would be a good place to put QA metrics measured during pipeline operation too.&lt;/p&gt;

&lt;p&gt;The desire to have key-value pairs where the values are of varying types (bool, int, float, string) makes it difficult/inconvenient to represent in FITS using conventional means. However, we would like to avoid using something python-specific like pickle, so that the data is easily accessible from any programming language. I think that the proposed representation, while perhaps unconventional, is simple and meets these design requirements.&lt;/p&gt;

&lt;p&gt;I propose to add a new HDU to spectral products (pfsArm, pfsMerged, pfsSingle, pfsObject). The reduction notes (&lt;tt&gt;NOTES&lt;/tt&gt;) HDU is a FITS image HDU consisting of a UTF-8-encoded JSON representation of (for multi-spectra products, an array of &lt;tt&gt;NFIBER&lt;/tt&gt; collections of) key-value pairs that record operations performed and measurements made during reduction. The HDU may be compressed using standard FITS compression conventions.&lt;/p&gt;

&lt;p&gt;I have &lt;a href=&quot;https://github.com/Subaru-PFS/datamodel/compare/tickets/PIPE2D-1143&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;a proposed implementation&lt;/a&gt; created in the course of working on &lt;a href=&quot;https://pfspipe.ipmu.jp/jira/browse/PIPE2D-1143&quot; title=&quot;sky subtraction is bad for a certain fraction of fibers in the faint galaxy frames taken during Nov run&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PIPE2D-1143&quot;&gt;&lt;del&gt;PIPE2D-1143&lt;/del&gt;&lt;/a&gt;, and welcome comments and suggestions.&lt;/p&gt;</description>
                <environment></environment>
        <key id="23217">DAMD-145</key>
            <summary>Add facility to hold history/metrics of spectra</summary>
                <type id="10001" iconUrl="https://pfspipe.ipmu.jp/jira/secure/viewavatar?size=xsmall&amp;avatarId=10515&amp;avatarType=issuetype">Story</type>
                                            <priority id="10000" iconUrl="https://pfspipe.ipmu.jp/jira/images/icons/priorities/medium.svg">Normal</priority>
                        <status id="10002" iconUrl="https://pfspipe.ipmu.jp/jira/images/icons/statuses/generic.png" description="The issue is resolved, reviewed, and merged">Done</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10000">Done</resolution>
                                        <assignee username="price">price</assignee>
                                    <reporter username="price">price</reporter>
                        <labels>
                    </labels>
                <created>Sat, 21 Jan 2023 00:35:28 +0000</created>
                <updated>Thu, 16 Feb 2023 16:10:08 +0000</updated>
                            <resolved>Thu, 16 Feb 2023 16:10:08 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>8</watches>
                                                                <comments>
                            <comment id="32109" author="vlebrun" created="Mon, 23 Jan 2023 15:32:37 +0000"  >&lt;p&gt;sounds good to me, are such comments readable/usable by the subsequent modules of the pipeline (eg PIPE1D), if we want to avoid errors which would be hard to detect in the spectrum itself but easy to anticipate from those comments, or will they be redundant to the flags anyway ?&lt;/p&gt;</comment>
                            <comment id="32110" author="price" created="Mon, 23 Jan 2023 16:06:57 +0000"  >&lt;p&gt;Here&apos;s an alternative proposal that avoids JSON:&lt;/p&gt;

&lt;p&gt;The reduction notes (&lt;tt&gt;NOTES&lt;/tt&gt;) HDU is a FITS table HDU consisting of the following columns:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;tt&gt;name&lt;/tt&gt; (string): the keyword name&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;blank&lt;/tt&gt; (variable-length array of int): indices of spectra for which the keyword is undefined.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;bool&lt;/tt&gt; (variable-length array of bool): values for spectra, if the field is of boolean type; otherwise, empty.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;int&lt;/tt&gt; (variable-length array of int): values for spectra, if the field is of integer type; otherwise, empty.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;float&lt;/tt&gt; (variable-length array of float): values for spectra, if the field is of floating-point type; otherwise, empty.&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;string&lt;/tt&gt; (variable-length array of string): values for spectra (&lt;tt&gt;NUL&lt;/tt&gt;-separated), if the field is of string type; otherwise empty.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;It&apos;s a fair bit more complicated, but it might save space by not having to write the keyword name many times and writing numbers as strings.&lt;/p&gt;</comment>
                            <comment id="32111" author="price" created="Mon, 23 Jan 2023 16:13:30 +0000"  >&lt;p&gt;&lt;a href=&quot;https://pfspipe.ipmu.jp/jira/secure/ViewProfile.jspa?name=vlebrun&quot; class=&quot;user-hover&quot; rel=&quot;vlebrun&quot;&gt;vlebrun&lt;/a&gt;: the &lt;tt&gt;notes&lt;/tt&gt; will be implemented in the python &lt;tt&gt;PfsObject&lt;/tt&gt; class that 1D operates on. It describes the spectrum as a whole, whereas the mask (&quot;flags&quot;) describe individual pixels within the spectrum. It may contain indications that the spectrum is not of good quality, but 1D should probably process it anyway and allow the user to choose whether to include it in their analysis or not.&lt;/p&gt;</comment>
                            <comment id="32115" author="pychabau" created="Tue, 24 Jan 2023 09:22:28 +0000"  >&lt;p&gt;&lt;a href=&quot;https://pfspipe.ipmu.jp/jira/secure/ViewProfile.jspa?name=price&quot; class=&quot;user-hover&quot; rel=&quot;price&quot;&gt;price&lt;/a&gt;: If I understand correctly your alternative proposal, for a given file, the size of the &quot;variable-length&quot; arrays is NFIBER, isn&apos;t it ?&lt;/p&gt;</comment>
                            <comment id="32116" author="price" created="Tue, 24 Jan 2023 15:19:06 +0000"  >&lt;p&gt;The number of entries in &lt;tt&gt;blank&lt;/tt&gt; plus the number of entries in one of &lt;tt&gt;bool&lt;/tt&gt;, &lt;tt&gt;int&lt;/tt&gt;, &lt;tt&gt;float&lt;/tt&gt; or &lt;tt&gt;string&lt;/tt&gt; should be &lt;tt&gt;NFIBER&lt;/tt&gt;.&lt;/p&gt;</comment>
                            <comment id="32124" author="kiyoto.yabe" created="Wed, 25 Jan 2023 07:09:33 +0000"  >&lt;p&gt;I think that will be very useful for QA as well. I like JSON indeed, if permitted. I&apos;m not sure if there is any restriction or policy on FITS when NAOJ delivers the output to users. And also, this is somewhat related to QA, so I take the liberty of inviting &lt;a href=&quot;https://pfspipe.ipmu.jp/jira/secure/ViewProfile.jspa?name=msyktnk&quot; class=&quot;user-hover&quot; rel=&quot;msyktnk&quot;&gt;Masayuki Tanaka&lt;/a&gt;&#160;to this discussion.&lt;/p&gt;</comment>
                            <comment id="32125" author="price" created="Wed, 25 Jan 2023 15:52:33 +0000"  >&lt;p&gt;I think I prefer the alternative proposal (FITS table) to the original (JSON). It&apos;s a bit more complicated, but it&apos;s probably more compact and doesn&apos;t require parsing text.&lt;/p&gt;</comment>
                            <comment id="32126" author="rhl" created="Wed, 25 Jan 2023 16:15:27 +0000"  >&lt;p&gt;Adding an HDU for this sort of thing is a good idea, which I endorse.  I also agree that pickle is a non-starter.&lt;/p&gt;

&lt;p&gt;However, I&apos;m not sure that I like a free-form non-datamodel controlled HDU.  How will we use this?  I&apos;d rather provide a light-weight way to add more keys to this HDU, or more precisely the python object which it maps to.  Do you have a sketch of this object?&lt;/p&gt;

&lt;p&gt;As part of this, how would we manage schema evolution? &amp;#8211; I think we only need to worry about adding more fields.&lt;/p&gt;</comment>
                            <comment id="32134" author="msyktnk" created="Thu, 26 Jan 2023 23:41:06 +0000"  >&lt;p&gt;Not sure what sort of QA we are thinking of here, but I had a bit of discussion with Hamano-san yesterday.&#160; Hamano-san made a good point; it makes a lot of sense to include QA metrics from the pipeline in the fits header (e.g., number/area of CR), but as we agreed before, QAs that NAOJ/IPMU are working on is a post-processing task, and we would prefer not to update the fits header&lt;/p&gt;</comment>
                            <comment id="32136" author="price" created="Fri, 27 Jan 2023 01:22:56 +0000"  >&lt;p&gt;The FITS header doesn&apos;t make sense for QA about individual spectra, because there are 650 spectra per spectrograph. It needs to go in a separate HDU.&lt;/p&gt;</comment>
                            <comment id="32137" author="msyktnk" created="Fri, 27 Jan 2023 01:28:20 +0000"  >&lt;p&gt;Sorry, I meant to say HDU instead of fits header.&#160; It might be OK to include detector-wide QA in the header, though.&lt;/p&gt;</comment>
                            <comment id="32150" author="sogo.mineo" created="Mon, 30 Jan 2023 05:15:38 +0000"  >&lt;p&gt;Koike-san is afraid of JSON being unable to distinguish between integers and floats. Many 64bit integers like &lt;tt&gt;pfsDesignId&lt;/tt&gt; exceeds 53bits. If they appear in the saved data, the stringified JSON won&apos;t be compatible though python&apos;s &lt;tt&gt;json&lt;/tt&gt; module can deal with them correctly. I add &lt;tt&gt;Infinity&lt;/tt&gt; and &lt;tt&gt;NaN&lt;/tt&gt; to him.&lt;/p&gt;</comment>
                            <comment id="32176" author="price" created="Wed, 1 Feb 2023 22:06:45 +0000"  >&lt;p&gt;I&apos;m going to take this as generally approved, with the amendments:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;The alternative proposal will be used for persistence.&lt;/li&gt;
	&lt;li&gt;The implementation will enforce a controlled schema.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I&apos;ll change the implementation on &lt;a href=&quot;https://pfspipe.ipmu.jp/jira/browse/PIPE2D-1143&quot; title=&quot;sky subtraction is bad for a certain fraction of fibers in the faint galaxy frames taken during Nov run&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PIPE2D-1143&quot;&gt;&lt;del&gt;PIPE2D-1143&lt;/del&gt;&lt;/a&gt;, and close this once it&apos;s done.&lt;/p&gt;</comment>
                            <comment id="32195" author="price" created="Sat, 4 Feb 2023 01:46:32 +0000"  >&lt;p&gt;There&apos;s a new implementation on &lt;a href=&quot;https://pfspipe.ipmu.jp/jira/browse/PIPE2D-1143&quot; title=&quot;sky subtraction is bad for a certain fraction of fibers in the faint galaxy frames taken during Nov run&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PIPE2D-1143&quot;&gt;&lt;del&gt;PIPE2D-1143&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="32251" author="price" created="Thu, 16 Feb 2023 16:10:08 +0000"  >&lt;p&gt;&lt;a href=&quot;https://pfspipe.ipmu.jp/jira/browse/PIPE2D-1143&quot; title=&quot;sky subtraction is bad for a certain fraction of fibers in the faint galaxy frames taken during Nov run&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PIPE2D-1143&quot;&gt;&lt;del&gt;PIPE2D-1143&lt;/del&gt;&lt;/a&gt; merged to master.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10000">
                    <name>Blocks</name>
                                            <outwardlinks description="blocks">
                                        <issuelink>
            <issuekey id="23200">PIPE2D-1143</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_10500" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|02qpjd:00r200603w</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10005" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="162">2DDRP-2023 A</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    </customfields>
    </item>
</channel>
</rss>