<!-- 
RSS generated by JIRA (8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b) at Sat Feb 10 15:57:24 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-759] Speed up makeFiberTracesFromDetectorMap</title>
                <link>https://pfspipe.ipmu.jp/jira/browse/PIPE2D-759</link>
                <project id="10002" key="PIPE2D">DRP 2-D Pipeline</project>
                    <description>&lt;p&gt;Running &lt;tt&gt;makeFiberTracesFromDetectorMap&lt;/tt&gt; takes 90-100s, a very significant part of running &lt;tt&gt;reduceExposure.py&lt;/tt&gt;. &#160;Please optimise the code, moving it to C++ if needs be.&lt;/p&gt;

&lt;p&gt;While processing a lot of data amortises this cost, for quick look on the mountain one is typically processing a visit at a time, and we cannot afford to wait so long. &#160;I have added checks in &lt;tt&gt;reduceExposureTask&lt;/tt&gt; so we don&apos;t pay this cost when simply running ISR, but that is not sufficient for e.g. &lt;tt&gt;plotSuNSSFluxes&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="15429">PIPE2D-759</key>
            <summary>Speed up makeFiberTracesFromDetectorMap</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="rhl">rhl</reporter>
                        <labels>
                    </labels>
                <created>Sat, 6 Mar 2021 20:25:33 +0000</created>
                <updated>Thu, 17 Jun 2021 19:38:26 +0000</updated>
                            <resolved>Thu, 17 Jun 2021 19:38:26 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                <comments>
                            <comment id="21491" author="price" created="Tue, 15 Jun 2021 20:05:04 +0000"  >&lt;p&gt;Time to beat is 49.390 sec.&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-scipipe) pprice@tiger2-sumire:~/pfs/drp_stella[master] $ python -m cProfile -o pipe2d-759-before.profile $(which reduceExposure.py) /projects/HSC/PFS/Subaru --calib /scratch/pprice/pipe2d-829/CALIB --rerun price/pipe2d-759 --id visit=46782 arm=r -c isr.doFlat=False isr.doDefect=False isr.doDark=False repair.interp.modelPsf.defaultFwhm=2.25 --no-versions
(lsst-scipipe) pprice@tiger2-sumire:~/pfs/drp_stella[master%] $ python -c &lt;span class=&quot;code-quote&quot;&gt;&apos;from pstats &lt;span class=&quot;code-keyword&quot;&gt;import&lt;/span&gt; Stats; Stats(&lt;span class=&quot;code-quote&quot;&gt;&quot;pipe2d-759-before.profile&quot;&lt;/span&gt;).sort_stats(&lt;span class=&quot;code-quote&quot;&gt;&quot;cumulative&quot;&lt;/span&gt;).print_stats(30)&apos;&lt;/span&gt;
Tue Jun 15 16:00:57 2021    pipe2d-759-before.profile

         161637507 function calls (157515421 primitive calls) in 226.881 seconds

   Ordered by: cumulative time
   List reduced from 9213 to 30 due to restriction &amp;lt;30&amp;gt;

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   1808/1    0.026    0.000  226.882  226.882 {built-in method builtins.exec}
        1    0.000    0.000  226.882  226.882 /home/pprice/pfs/drp_stella/bin/reduceExposure.py:23(&amp;lt;module&amp;gt;)
        1    0.000    0.000  223.812  223.812 /tigress/HSC/PFS/stack/20190925/stack/miniconda3-4.5.12-1172c30/Linux64/pipe_base/18.1.0/python/lsst/pipe/base/cmdLineTask.py:548(parseAndRun)
        1    0.099    0.099  222.879  222.879 /tigress/HSC/PFS/stack/20190925/stack/miniconda3-4.5.12-1172c30/Linux64/pipe_base/18.1.0/python/lsst/pipe/base/cmdLineTask.py:183(run)
        1    0.000    0.000  222.774  222.774 /tigress/HSC/PFS/stack/20190925/stack/miniconda3-4.5.12-1172c30/Linux64/pipe_base/18.1.0/python/lsst/pipe/base/cmdLineTask.py:341(__call__)
        1    0.048    0.048  222.773  222.773 /tigress/HSC/PFS/stack/20190925/stack/miniconda3-4.5.12-1172c30/Linux64/pipe_base/18.1.0/python/lsst/pipe/base/cmdLineTask.py:428(runTask)
        1    0.000    0.000  222.725  222.725 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/reduceExposure.py:166(runDataRef)
        1    0.051    0.051  216.054  216.054 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/reduceExposure.py:402(getSpectralCalibs)
        1    0.005    0.005   94.666   94.666 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/photometerLines.py:56(run)
1349/1085    0.019    0.000   92.073    0.085 {built-in method builtins.next}
        4    0.049    0.012   92.030   23.008 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fitContinuum.py:260(subtractionContext)
       72    0.000    0.000   91.995    1.278 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/contextlib.py:107(__enter__)
        2    1.547    0.774   91.981   45.990 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fitContinuum.py:228(subtractContinuum)
        2    0.007    0.004   89.858   44.929 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fitContinuum.py:54(run)
      502    0.104    0.000   89.827    0.179 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fitContinuum.py:81(fitContinuum)
      502   57.959    0.115   82.754    0.165 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fitContinuum.py:195(maskLines)
        2    0.000    0.000   49.390   24.695 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fiberProfileSet.py:119(makeFiberTracesFromDetectorMap)
        2    0.018    0.009   49.208   24.604 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fiberProfileSet.py:137(makeFiberTraces)
      502   19.232    0.038   49.190    0.098 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fiberProfile.py:228(makeFiberTrace)
        1    0.022    0.022   40.013   40.013 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/adjustDetectorMap.py:65(run)
        4    0.019    0.005   39.337    9.834 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/adjustDetectorMap.py:254(fit)
        4    0.000    0.000   39.006    9.752 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/_minimize.py:42(minimize)
        4    0.001    0.000   39.006    9.751 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:2509(_minimize_powell)
      518    0.443    0.001   38.988    0.075 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:298(function_wrapper)
      518    1.392    0.003   38.545    0.074 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/adjustDetectorMap.py:219(calculateChi2)
       55    0.001    0.000   38.326    0.697 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:2364(_linesearch_powell)
       55    0.000    0.000   38.325    0.697 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:2011(brent)
       55    0.001    0.000   38.324    0.697 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:2090(_minimize_scalar_brent)
       55    0.010    0.000   38.323    0.697 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:1896(optimize)
      509    0.004    0.000   38.313    0.075 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:2370(myfunc)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="21498" author="price" created="Wed, 16 Jun 2021 18:14:27 +0000"  >&lt;p&gt;Got it working in C++, but with worse precision: &lt;tt&gt;test_profileNorm.py&lt;/tt&gt; is failing because the residuals of the extracted spectra have a standard deviation of about 3.5e-8 instead of 1.5e-8. But the time has been reduced to 1.547 sec, almost a 32x reduction!&lt;/p&gt;

&lt;p&gt;I&apos;m going to see if I can find an obvious cause of the loss of precision, but it&apos;s not too awful so I&apos;m not sure it&apos;s worth a lot of extra effort.&lt;/p&gt;</comment>
                            <comment id="21499" author="price" created="Wed, 16 Jun 2021 19:27:46 +0000"  >&lt;p&gt;Found the problem, and we&apos;re passing all tests now.&lt;/p&gt;

&lt;p&gt;Following this change, tall poles are now the continuum subtraction and detectorMap adjustment:&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-scipipe) pprice@tiger2-sumire:~/pfs/drp_stella[tickets/PIPE2D-759%] $ python -c &lt;span class=&quot;code-quote&quot;&gt;&apos;from pstats &lt;span class=&quot;code-keyword&quot;&gt;import&lt;/span&gt; Stats; Stats(&lt;span class=&quot;code-quote&quot;&gt;&quot;pipe2d-759-after.profile&quot;&lt;/span&gt;).sort_stats(&lt;span class=&quot;code-quote&quot;&gt;&quot;cumulative&quot;&lt;/span&gt;).print_stats(30)&apos;&lt;/span&gt;
Wed Jun 16 15:23:19 2021    pipe2d-759-after.profile

         156838987 function calls (152716719 primitive calls) in 177.606 seconds

   Ordered by: cumulative time
   List reduced from 9208 to 30 due to restriction &amp;lt;30&amp;gt;

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   1822/1    0.026    0.000  177.607  177.607 {built-in method builtins.exec}
        1    0.000    0.000  177.607  177.607 /home/pprice/pfs/drp_stella/bin/reduceExposure.py:23(&amp;lt;module&amp;gt;)
        1    0.000    0.000  174.097  174.097 /tigress/HSC/PFS/stack/20190925/stack/miniconda3-4.5.12-1172c30/Linux64/pipe_base/18.1.0/python/lsst/pipe/base/cmdLineTask.py:548(parseAndRun)
        1    0.076    0.076  172.896  172.896 /tigress/HSC/PFS/stack/20190925/stack/miniconda3-4.5.12-1172c30/Linux64/pipe_base/18.1.0/python/lsst/pipe/base/cmdLineTask.py:183(run)
        1    0.000    0.000  172.698  172.698 /tigress/HSC/PFS/stack/20190925/stack/miniconda3-4.5.12-1172c30/Linux64/pipe_base/18.1.0/python/lsst/pipe/base/cmdLineTask.py:341(__call__)
        1    0.049    0.049  172.697  172.697 /tigress/HSC/PFS/stack/20190925/stack/miniconda3-4.5.12-1172c30/Linux64/pipe_base/18.1.0/python/lsst/pipe/base/cmdLineTask.py:428(runTask)
        1    0.000    0.000  172.649  172.649 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/reduceExposure.py:166(runDataRef)
        1    0.063    0.063  166.064  166.064 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/reduceExposure.py:402(getSpectralCalibs)
        1    0.004    0.004   92.969   92.969 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/photometerLines.py:56(run)
1349/1086    0.021    0.000   90.462    0.083 {built-in method builtins.next}
       70    0.000    0.000   90.353    1.291 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/contextlib.py:107(__enter__)
        4    0.049    0.012   90.329   22.582 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fitContinuum.py:260(subtractionContext)
        2    1.461    0.730   90.280   45.140 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fitContinuum.py:228(subtractContinuum)
        2    0.007    0.004   88.150   44.075 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fitContinuum.py:54(run)
      502    0.109    0.000   88.119    0.176 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fitContinuum.py:81(fitContinuum)
      502   56.832    0.113   80.974    0.161 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/fitContinuum.py:195(maskLines)
        1    0.025    0.025   39.220   39.220 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/adjustDetectorMap.py:65(run)
        4    0.020    0.005   38.515    9.629 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/adjustDetectorMap.py:254(fit)
        4    0.000    0.000   38.190    9.548 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/_minimize.py:42(minimize)
        4    0.001    0.000   38.190    9.547 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:2509(_minimize_powell)
      518    0.400    0.001   38.173    0.074 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:298(function_wrapper)
      518    1.366    0.003   37.773    0.073 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/adjustDetectorMap.py:219(calculateChi2)
       55    0.001    0.000   37.521    0.682 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:2364(_linesearch_powell)
       55    0.000    0.000   37.520    0.682 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:2011(brent)
       55    0.001    0.000   37.519    0.682 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:2090(_minimize_scalar_brent)
       55    0.009    0.000   37.518    0.682 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:1896(optimize)
      509    0.004    0.000   37.508    0.074 /tigress/HSC/PFS/stack/20190925/python/miniconda3-4.5.12/envs/lsst-scipipe/lib/python3.7/site-packages/scipy/optimize/optimize.py:2370(myfunc)
        1    0.097    0.097   29.446   29.446 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/centroidLines.py:72(run)
        1    0.000    0.000   24.276   24.276 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/centroidLines.py:109(centroidLines)
      522    8.448    0.016   22.877    0.044 /home/pprice/pfs/drp_stella/python/pfs/drp/stella/adjustDetectorMap.py:201(calculateLineResiduals)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="21515" author="hassan" created="Thu, 17 Jun 2021 19:38:18 +0000"  >&lt;p&gt;Updates look fine.&lt;/p&gt;</comment>
                            <comment id="21516" author="price" created="Thu, 17 Jun 2021 19:38:26 +0000"  >&lt;p&gt;Merged.&lt;/p&gt;</comment>
                    </comments>
                    <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|02qpt6:508yl0chzzy00000zj</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10005" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="102">2DDRP-2021 A3</customfieldvalue>
    <customfieldvalue id="109">2DDRP-2021 A5</customfieldvalue>
    <customfieldvalue id="111">2DDRP-2021 A 6</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Story Points</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                        </customfields>
    </item>
</channel>
</rss>