<!-- 
RSS generated by JIRA (8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b) at Sat Feb 10 16:06:34 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>[PIPE2D-1362] correct for the focal plane variation of the flux calibration vector</title>
                <link>https://pfspipe.ipmu.jp/jira/browse/PIPE2D-1362</link>
                <project id="10002" key="PIPE2D">DRP 2-D Pipeline</project>
                    <description>&lt;p&gt;After applying the fix for &lt;a href=&quot;https://pfspipe.ipmu.jp/jira/browse/PIPE2D-1361&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;PIPD2D-1361&lt;/a&gt;, we clearly observe the spatial variation of the flux calibration vector. The variation likely has two components; the global pattern due to the global offset, rotation, and scale difference, and fiber-to-fiber offset. We want to correct for the former with, e.g., low-order polinomials. As the seeing is a function of wavelength, a fiber offset introduces a wavelength-dependent flux loss. We thus need to allow the flux calibration vector to vary both spatially and along the wavelength. The correction can be estimated by comparing the PS1 magnitudes and synthetic PS1 magnitudes of each FLUXSTD.&lt;/p&gt;</description>
                <environment></environment>
        <key id="24501">PIPE2D-1362</key>
            <summary>correct for the focal plane variation of the flux calibration vector</summary>
                <type id="3" iconUrl="https://pfspipe.ipmu.jp/jira/secure/viewavatar?size=xsmall&amp;avatarId=10518&amp;avatarType=issuetype">Task</type>
                                            <priority id="10000" iconUrl="https://pfspipe.ipmu.jp/jira/images/icons/priorities/medium.svg">Normal</priority>
                        <status id="10000" iconUrl="https://pfspipe.ipmu.jp/jira/images/icons/statuses/generic.png" description="Issue is reviewed and ready to be merged and closed">Review Complete</status>
                    <statusCategory id="4" key="indeterminate" colorName="yellow"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="sogo.mineo">sogo.mineo</assignee>
                                    <reporter username="msyktnk">Masayuki Tanaka</reporter>
                        <labels>
                            <label>EDR</label>
                            <label>EngRun</label>
                    </labels>
                <created>Wed, 31 Jan 2024 00:24:05 +0000</created>
                <updated>Fri, 9 Feb 2024 19:10:05 +0000</updated>
                                                                                <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                <comments>
                            <comment id="36909" author="msyktnk" created="Wed, 31 Jan 2024 00:29:06 +0000"  >&lt;p&gt;The figures here show the magnitude and color offsets with respect to the PS1 photometry. The first figure is the i-band magnitude offset and the 2nd one is g-y color offset. Note the similar spatial patterns. This is due to the wavelength dependence of the seeing.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://pfspipe.ipmu.jp/jira/secure/attachment/17100/17100_fig1_nocorr.png&quot; height=&quot;430&quot; width=&quot;474&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://pfspipe.ipmu.jp/jira/secure/attachment/17101/17101_fig2_nocorr.png&quot; height=&quot;427&quot; width=&quot;471&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;</comment>
                            <comment id="36910" author="rhl" created="Wed, 31 Jan 2024 00:34:42 +0000"  >&lt;p&gt;We have to think about how much the fibre-to-fibre variation is corrected by the fibre profiles (and associated normalisation).  That&apos;s done using a roughly uniform surface brightness, but it should take out the fibre throughput variation &amp;#8211; although it&apos;s hard to separate this from spatial variation. &lt;/p&gt;</comment>
                            <comment id="36912" author="msyktnk" created="Wed, 31 Jan 2024 00:53:32 +0000"  >&lt;p&gt;I should have been clearer. What I meant by the fiber-to-fiber variation is the residual fiber offset after we take out the global offset/pattern. I imagine the residual offset is nearly random (but I may be wrong). I agree that the throughput variation between the fibers will be largely taken out by the quartz.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://pfspipe.ipmu.jp/jira/secure/ViewProfile.jspa?name=sogo.mineo&quot; class=&quot;user-hover&quot; rel=&quot;sogo.mineo&quot;&gt;sogo.mineo&lt;/a&gt; already implemented a correction function in the flux calibration code (I should have filed this ticket when he started, sorry). He can elaborate on the algorithmic details, but here are the plots after the correction is applied. The first set of the figures is for 3rd order correction and the 2nd set for 4th order correction.&lt;br/&gt;
&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://pfspipe.ipmu.jp/jira/secure/attachment/17104/17104_fig1_3rd_order.png&quot; height=&quot;385&quot; width=&quot;425&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://pfspipe.ipmu.jp/jira/secure/attachment/17105/17105_fig2_3rd_order.png&quot; height=&quot;383&quot; width=&quot;422&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;



&lt;p&gt;4th order:&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://pfspipe.ipmu.jp/jira/secure/attachment/17106/17106_fig1_4th_order.png&quot; height=&quot;371&quot; width=&quot;409&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;span class=&quot;image-wrap&quot; style=&quot;&quot;&gt;&lt;img src=&quot;https://pfspipe.ipmu.jp/jira/secure/attachment/17107/17107_fig2_4th_order.png&quot; height=&quot;372&quot; width=&quot;410&quot; style=&quot;border: 0px solid black&quot; /&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="36915" author="sogo.mineo" created="Wed, 31 Jan 2024 07:44:01 +0000"  >&lt;p&gt;The details of fitting &lt;tt&gt;FluxCalib&lt;/tt&gt; (a subclass of &lt;tt&gt;FocalPlaneFunction&lt;/tt&gt;) is:&lt;/p&gt;

&lt;p&gt;1. Divide observed spectra of flux standards by reference spectra to get proto-fluxCalib vectors.&lt;br/&gt;
2. Adjust heights of the proto-fluxCalib vectors to each other.&lt;br/&gt;
3. Take their average to get h(lam) (&lt;tt&gt;ConstantFocalPlaneFunction&lt;/tt&gt;)&lt;br/&gt;
4. Let g(x, y, lam) be a trivariate polynomial (of order 3 by default).&lt;br/&gt;
5. Let f(x, y, lam) =  h(lam) exp(g(x, y, lam)). This is a &lt;tt&gt;FluxCalib&lt;/tt&gt;.&lt;br/&gt;
6. Let (calibrated spectrum) = (observed spectrum) / f(x&lt;span class=&quot;error&quot;&gt;&amp;#91;i&amp;#93;&lt;/span&gt;, y&lt;span class=&quot;error&quot;&gt;&amp;#91;i&amp;#93;&lt;/span&gt;, lam) for each flux standard.&lt;br/&gt;
7. Integrate calibrated spectra to get synthetic broadband fluxes.&lt;br/&gt;
8. Let chisq be the sum of ((broadband flux in pfsConfig) - (synthetic broadband flux))^2 / error^2&lt;br/&gt;
9. Minimize chisq.&lt;/p&gt;

&lt;p&gt;So, I distort the average fluxCalib h(lam) to forcibly make it conform to pfsConfig.psfFlux.&lt;br/&gt;
Though I am not sure the resulting fluxCalib is good for spectroscopy, Tanaka-san&apos;s images show that the distortion is working well.&lt;/p&gt;</comment>
                            <comment id="36917" author="sogo.mineo" created="Wed, 31 Jan 2024 08:03:01 +0000"  >&lt;p&gt;Could you review PRs of &lt;tt&gt;datamodel&lt;/tt&gt; and &lt;tt&gt;drp_stella&lt;/tt&gt;, too?&lt;/p&gt;</comment>
                            <comment id="37130" author="sogo.mineo" created="Thu, 8 Feb 2024 03:15:26 +0000"  >&lt;p&gt;The PRs have been approved, but I just found that the integration test would break during &lt;tt&gt;coaddSpectra.py&lt;/tt&gt; because an instance of &lt;tt&gt;FluxCalib&lt;/tt&gt; class (named &quot;fluxCal&quot; in butler) cannot be created. The reason for this is that &lt;tt&gt;FluxCalib&lt;/tt&gt; is defined outside &lt;tt&gt;focalPlaneFunction.py&lt;/tt&gt; even though it is a subclass of &lt;tt&gt;FocalPlaneFunction&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;I decided to define &lt;tt&gt;FluxCalib&lt;/tt&gt; in &lt;tt&gt;fitFluxCal.py&lt;/tt&gt; because its overrided method &lt;tt&gt;fitArrays()&lt;/tt&gt; has a parameter of type &lt;tt&gt;BroadbandFluxChi2&lt;/tt&gt;. This class is not general enough to be known to &lt;tt&gt;focalPlaneFunction.py&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;This problem is solved if I revise &lt;tt&gt;PfsMapper.yaml&lt;/tt&gt; in &lt;tt&gt;obs_pfs&lt;/tt&gt; so that the type of &lt;tt&gt;&quot;fluxCal&quot;&lt;/tt&gt; will be &lt;tt&gt;FluxCalib&lt;/tt&gt;. But if I do so, the output of &lt;tt&gt;fluxCalibrate.py&lt;/tt&gt; will not be able to be read by &lt;tt&gt;coaddSpectra.py&lt;/tt&gt;,&lt;/p&gt;

&lt;p&gt;Does anyone have an idea to solve this problem?&lt;/p&gt;</comment>
                            <comment id="37131" author="sogo.mineo" created="Thu, 8 Feb 2024 06:25:37 +0000"  >&lt;p&gt;I pushed another commit. I moved &lt;tt&gt;FluxCalib&lt;/tt&gt; class to &lt;tt&gt;focalPlaneFunction.py&lt;/tt&gt;. Its method &lt;tt&gt;fitArrays()&lt;/tt&gt; takes a parameter &lt;tt&gt;fitter&lt;/tt&gt;, and all that &lt;tt&gt;fitArrays()&lt;/tt&gt; does is to call &lt;tt&gt;fitter()&lt;/tt&gt;. After this commit, the Gen2 integration test passes.&lt;/p&gt;

&lt;p&gt;Gen3 test still fails:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
lsst.ctrl.mpexec.mpGraphExecutor INFO: Executed 24 quanta successfully, 0 failed and 3 remain out of total 27 quanta.
py.warnings WARNING: /data22a/mineo/pfswork/pfsrepos/drp_stella/python/pfs/drp/stella/utils/polynomialND.py:76: RuntimeWarning: divide by zero encountered in true_divide
  self._scale = 1.0 / (self._max - self._min)

py.warnings WARNING: /data22a/mineo/pfswork/pfsrepos/drp_stella/python/pfs/drp/stella/utils/polynomialND.py:130: RuntimeWarning: invalid value encountered in multiply
  x *= scale

lsst.ctrl.mpexec.singleQuantumExecutor ERROR: Execution of task &lt;span class=&quot;code-quote&quot;&gt;&apos;fitFluxCal&apos;&lt;/span&gt; on quantum {instrument: &lt;span class=&quot;code-quote&quot;&gt;&apos;PFS-F&apos;&lt;/span&gt;, exposure: 24, ...} failed. Exception RuntimeError: No good points
&lt;span class=&quot;code-object&quot;&gt;Process&lt;/span&gt; task-{instrument: &lt;span class=&quot;code-quote&quot;&gt;&apos;PFS-F&apos;&lt;/span&gt;, exposure: 24, ...}:
Traceback (most recent call last):
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-3.0.0/lib/python3.8/multiprocessing/process.py&quot;&lt;/span&gt;, line 315, in _bootstrap
    self.run()
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/conda/miniconda3-py38_4.9.2/envs/lsst-scipipe-3.0.0/lib/python3.8/multiprocessing/process.py&quot;&lt;/span&gt;, line 108, in run
    self._target(*self._args, **self._kwargs)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/ctrl_mpexec/gb02ad94e9c+e480a1db32/python/lsst/ctrl/mpexec/mpGraphExecutor.py&quot;&lt;/span&gt;, line 143, in _executeJob
    quantumExecutor.execute(taskDef, quantum, butler)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/ctrl_mpexec/gb02ad94e9c+e480a1db32/python/lsst/ctrl/mpexec/singleQuantumExecutor.py&quot;&lt;/span&gt;, line 135, in execute
    result = self._execute(taskDef, quantum, butler)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/ctrl_mpexec/gb02ad94e9c+e480a1db32/python/lsst/ctrl/mpexec/singleQuantumExecutor.py&quot;&lt;/span&gt;, line 212, in _execute
    self.runQuantum(runTask, quantum, taskDef, butler)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/ctrl_mpexec/gb02ad94e9c+e480a1db32/python/lsst/ctrl/mpexec/singleQuantumExecutor.py&quot;&lt;/span&gt;, line 580, in runQuantum
    task.runQuantum(butlerQC, inputRefs, outputRefs)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/pfsrepos/drp_stella/python/pfs/drp/stella/fitFluxCal.py&quot;&lt;/span&gt;, line 761, in runQuantum
    outputs = self.run(**inputs, pfsArmList=armInputs.pfsArm, sky1dList=armInputs.sky1d)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/pfsrepos/drp_stella/python/pfs/drp/stella/fitFluxCal.py&quot;&lt;/span&gt;, line 703, in run
    fluxCal = self.calculateCalibrations(pfsConfig, pfsMerged, pfsMergedLsf, references)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/pfsrepos/drp_stella/python/pfs/drp/stella/fitFluxCal.py&quot;&lt;/span&gt;, line 900, in calculateCalibrations
    &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; self.fitFocalPlane.run(
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/pfsrepos/drp_stella/python/pfs/drp/stella/fitFocalPlane.py&quot;&lt;/span&gt;, line 109, in run
    raise RuntimeError(&lt;span class=&quot;code-quote&quot;&gt;&quot;No good points&quot;&lt;/span&gt;)
RuntimeError: No good points
lsst.daf.butler.cli.utils ERROR: Caught an exception, details are in traceback:
Traceback (most recent call last):
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/ctrl_mpexec/gb02ad94e9c+e480a1db32/python/lsst/ctrl/mpexec/cli/cmd/commands.py&quot;&lt;/span&gt;, line 130, in run
    script.run(qgraphObj=qgraph, **kwargs)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/ctrl_mpexec/gb02ad94e9c+e480a1db32/python/lsst/ctrl/mpexec/cli/script/run.py&quot;&lt;/span&gt;, line 187, in run
    f.runPipeline(qgraphObj, taskFactory, args)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/ctrl_mpexec/gb02ad94e9c+e480a1db32/python/lsst/ctrl/mpexec/cmdLineFwk.py&quot;&lt;/span&gt;, line 740, in runPipeline
    executor.execute(graph, butler)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/ctrl_mpexec/gb02ad94e9c+e480a1db32/python/lsst/ctrl/mpexec/mpGraphExecutor.py&quot;&lt;/span&gt;, line 373, in execute
    self._executeQuantaMP(graph, butler)
  File &lt;span class=&quot;code-quote&quot;&gt;&quot;/data22a/mineo/pfswork/lsst_stack/lsst_home/stack/miniconda3-py38_4.9.2-3.0.0/Linux64/ctrl_mpexec/gb02ad94e9c+e480a1db32/python/lsst/ctrl/mpexec/mpGraphExecutor.py&quot;&lt;/span&gt;, line 568, in _executeQuantaMP
    raise MPGraphExecutorError(message)
lsst.ctrl.mpexec.mpGraphExecutor.MPGraphExecutorError: Task &amp;lt;TaskDef(pfs.drp.stella.fitFluxCal.FitFluxCalTask, label=fitFluxCal) dataId={instrument: &lt;span class=&quot;code-quote&quot;&gt;&apos;PFS-F&apos;&lt;/span&gt;, exposure: 24, ...}&amp;gt; failed, exit code=1
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Is this error the one that &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; told me a few weeks ago?&lt;/p&gt;</comment>
                            <comment id="37132" author="price" created="Thu, 8 Feb 2024 13:06:28 +0000"  >&lt;p&gt;Yes, I think that&apos;s the same one. It would be great if you could also fix that.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="24500">PIPE2D-1361</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="17104" name="fig1_3rd_order.png" size="83343" author="msyktnk" created="Wed, 31 Jan 2024 00:51:46 +0000"/>
                            <attachment id="17106" name="fig1_4th_order.png" size="83276" author="msyktnk" created="Wed, 31 Jan 2024 00:52:27 +0000"/>
                            <attachment id="17100" name="fig1_nocorr.png" size="84759" author="msyktnk" created="Wed, 31 Jan 2024 00:26:22 +0000"/>
                            <attachment id="17105" name="fig2_3rd_order.png" size="79811" author="msyktnk" created="Wed, 31 Jan 2024 00:51:59 +0000"/>
                            <attachment id="17107" name="fig2_4th_order.png" size="79265" author="msyktnk" created="Wed, 31 Jan 2024 00:52:45 +0000"/>
                            <attachment id="17101" name="fig2_nocorr.png" size="79833" author="msyktnk" created="Wed, 31 Jan 2024 00:27:36 +0000"/>
                    </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_10006" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PIPE2D-303</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|zzt14f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10100" key="com.atlassian.jira.plugin.system.customfieldtypes:userpicker">
                        <customfieldname>Reviewers</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>price</customfieldvalue>

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