<!-- 
RSS generated by JIRA (8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b) at Sat Feb 10 15:57:38 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-778] Difference between pipeline and 2d algorithm - interpolation/downsampling</title>
                <link>https://pfspipe.ipmu.jp/jira/browse/PIPE2D-778</link>
                <project id="10002" key="PIPE2D">DRP 2-D Pipeline</project>
                    <description>&lt;p&gt;This ticket is to investigate Problem nr. 2 described in &lt;a href=&quot;https://pfspipe.ipmu.jp/jira/browse/PIPE2D-777&quot; title=&quot;Difference in centering between pipeline and 2d algorithm - centering and normalization&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PIPE2D-777&quot;&gt;&lt;del&gt;PIPE2D-777&lt;/del&gt;&lt;/a&gt; i.e., that the 2d model generated by the pipeline based on Zernike modeling is different than the results directly generated my modeling algorithm. This is even after recentering them to have the same centers of light. I presume that this is due to differences in interpolation/downsampling details. See&#160;&lt;a href=&quot;https://pfspipe.ipmu.jp/jira/browse/PIPE2D-777&quot; title=&quot;Difference in centering between pipeline and 2d algorithm - centering and normalization&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PIPE2D-777&quot;&gt;&lt;del&gt;PIPE2D-777&lt;/del&gt;&lt;/a&gt; for figures and more details.&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="15458">PIPE2D-778</key>
            <summary>Difference between pipeline and 2d algorithm - interpolation/downsampling</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="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="ncaplar">ncaplar</assignee>
                                    <reporter username="ncaplar">ncaplar</reporter>
                        <labels>
                    </labels>
                <created>Fri, 12 Mar 2021 13:32:50 +0000</created>
                <updated>Wed, 28 Jul 2021 14:35:41 +0000</updated>
                            <resolved>Sat, 26 Jun 2021 00:49:08 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                <comments>
                            <comment id="21528" author="ncaplar" created="Fri, 18 Jun 2021 13:05:36 +0000"  >&lt;p&gt;This is somewhat tricky as Lancszos interpolation used in the pipeline is buried quite deep and within C layer of the code. On the other hand, I have not been able to find&#160; readily available&#160; Lancszos interpolation codes in python that would reliably reproduce the results of the pipeline. I have found an implementation in torch&lt;img class=&quot;emoticon&quot; src=&quot;https://pfspipe.ipmu.jp/jira/images/icons/emoticons/warning.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; which I could strip and modify, but it is not obvious it is worth the time and effort given the relatively small difference between currently used bilinear interpolation in my code and Lancszos code - and the fact that I will probably need to refactor my code to be LSST code based at some point in the future. I have to consider this a little bit further.&#160;&lt;/p&gt;</comment>
                            <comment id="21529" author="rhl" created="Fri, 18 Jun 2021 13:09:41 +0000"  >&lt;p&gt;It should be trivial to implement exactly the same Lanczos kernel in python (although I&apos;m surprised that it&apos;s not in scipy). &#160;I can do that if needs be.&lt;/p&gt;</comment>
                            <comment id="21530" author="ncaplar" created="Fri, 18 Jun 2021 13:25:37 +0000"  >&lt;p&gt;Indeed, I have been able to implement it on my own (see small example of shift with maaaany wiggles). I searched quite extensively and was not able to identify Lanszscos (capable to going to 5) implementation that was readily usable (for example, no mention in scipy &lt;a href=&quot;https://docs.scipy.org/doc/scipy/reference/search.html?q=lanczos&amp;amp;check_keywords=yes&amp;amp;area=default&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://docs.scipy.org/doc/scipy/reference/search.html?q=lanczos&amp;amp;check_keywords=yes&amp;amp;area=default&lt;/a&gt;&#160;, only Lanczos fitting algorithm / one could construct it with scipy.special.sinc). I am just expressing some worry rewriting everything with my implementation which might be prone to errors and the amount of time that might take given other priorities.&lt;/p&gt;</comment>
                            <comment id="21532" author="ncaplar" created="Sun, 20 Jun 2021 15:15:00 +0000"  >&lt;p&gt;After discussion with Robert on Slack, I have made slight modifications to the algorithm so that it can fully ran under LSST imports. There were some minor changes, which probably arise from slight differences in python version and other imports, but which do not change the final image. The only larger difference is that I was using &lt;em&gt;scikit-image&lt;/em&gt;&#160;libarary for one resizing operation, which was trivially replaced.&lt;br/&gt;
 I have not yet tested if I could run the fitting algorithm also under LSST code (the algorithm which searches for best parameters of the fit), which may have other dependencies not in LSST at the moment (most likely there might be some problems in the way how I do multiprocesing?). I would have to check that.&lt;/p&gt;

&lt;p&gt;For the same test image in the focus, running on tiger-sumire, I am getting:&lt;/p&gt;

&lt;p&gt;without LSST stack: `840 ms &#177; 3.69 ms per loop(mean &#177; std. dev. of 7 runs, 1 loop each)`&lt;br/&gt;
 with LSST stack: `1.29 s &#177; 106 ms per loop (mean &#177; std. dev. of 7 runs, 1 loop each)`&lt;/p&gt;

&lt;p&gt;I ran %timeit many times and the result are roughly the same each time. I am confused my much lower variance in `without LSST&apos; result. This result suggests that the slow down is around 50% for in-focus images. I have to investigate where the slowdown is coming from (i.e., is it from FFT calculation and using/not using of MKL libraries)&lt;/p&gt;</comment>
                            <comment id="21563" author="ncaplar" created="Thu, 24 Jun 2021 18:16:56 +0000"  >&lt;p&gt;After some consideration, and talking with Josh Meyers, and looking how the pipeline code is set up, I think it is easiest and most convenient to use galsim.InterpolatedImage functionality. This makes it possible to use&#160;Lanczos5 as an interpolant and plays nicely with other functionality that I have + the pipeline as well. I have tested that the shift of 0.5 pixel with the pipeline function on an oversampled image in focus (with fuction lsst.afw.math import offsetImage, which is invoked in the pipeline) creates exactly the same change as when using galsim. This is shown in&#160;comparison_galsim_pipeline.png&lt;/p&gt;</comment>
                            <comment id="21564" author="rhl" created="Thu, 24 Jun 2021 19:30:19 +0000"  >&lt;p&gt;That sounds fine, but won&apos;t you still have to integrate with the &quot;real&quot; Rubin pipeline soon?&lt;/p&gt;</comment>
                            <comment id="21565" author="ncaplar" created="Thu, 24 Jun 2021 19:59:53 +0000"  >&lt;p&gt;Yes, indeed. I think we need to talk so that I can understand how this will be achieved, i.e., how will the psf object be constructed. But note, as you are aware, that galsim is LSST package. And I do need some functionality to do fitting of defocused and focused images which I dont think it would be easily run through ``real&apos;&apos; pipeline - but in this way it will be using the same algorithms as the ``real&apos;&apos; pipeline.&lt;/p&gt;</comment>
                            <comment id="21567" author="ncaplar" created="Sat, 26 Jun 2021 00:49:01 +0000"  >&lt;p&gt;I have incorporated galsim Lanczos5 procedures at all relevant places in my module, internal version 0.47a. Closing this ticket, and evaluating in the next release of the solutions.&#160;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                            <outwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="16972">PIPE2D-874</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="13538">PIPE2D-408</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="13936" name="comparison_galsim_pipeline.png" size="31856" author="ncaplar" created="Thu, 24 Jun 2021 18:15:54 +0000"/>
                            <attachment id="13928" name="example_of_kernel_with_many.png" size="28953" author="ncaplar" created="Fri, 18 Jun 2021 13:22:17 +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_10010" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|zzs4or:9</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10005" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="105">2DDRP-2021 A 4</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>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                        </customfields>
    </item>
</channel>
</rss>