<!-- 
RSS generated by JIRA (8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b) at Sat Feb 10 16:03:40 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-1168] fitPfsReferenceFlux breaks Tiger</title>
                <link>https://pfspipe.ipmu.jp/jira/browse/PIPE2D-1168</link>
                <project id="10002" key="PIPE2D">DRP 2-D Pipeline</project>
                    <description>&lt;p&gt;Running &lt;tt&gt;fitPfsReferenceFlux&lt;/tt&gt; on our Tiger head node trashes the machine. I am reducing the new weekly:&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;
fitPfsReferenceFlux.py /scratch/pprice/sim2d-151/test --calib=/scratch/pprice/sim2d-151/test/CALIB --rerun=weekly/pipeline/brn/pipeline --doraise -j10 --no-versions --clobber-config --id &lt;span class=&quot;code-quote&quot;&gt;&apos;visit=47^48^49^53^54^57&apos;&lt;/span&gt; &lt;span class=&quot;code-quote&quot;&gt;&apos;arm=b^r^n&apos;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I suspect that the &lt;tt&gt;fluxmodeldata&lt;/tt&gt; is being accessed within a tight loop, which causes a huge load on the disk.&lt;/p&gt;</description>
                <environment></environment>
        <key id="23262">PIPE2D-1168</key>
            <summary>fitPfsReferenceFlux breaks Tiger</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>Tue, 21 Feb 2023 19:40:20 +0000</created>
                <updated>Fri, 16 Jun 2023 06:56:30 +0000</updated>
                            <resolved>Tue, 28 Feb 2023 19:33:32 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                <comments>
                            <comment id="32283" author="price" created="Wed, 22 Feb 2023 23:05:09 +0000"  >&lt;p&gt;Moving the &lt;tt&gt;fluxmodeldata&lt;/tt&gt; to a faster disk has alleviated the problem on tiger.&lt;/p&gt;

&lt;p&gt;I took the opportunity to look at the &lt;tt&gt;fitPfsFluxReference&lt;/tt&gt; code and made some observations that might help improve it moving forward:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Reading the 9 GB &lt;tt&gt;fluxModelInterpolator&lt;/tt&gt; pickle is done in the &lt;tt&gt;FitPfsFluxReferenceTask&lt;/tt&gt; init, which means it&apos;s read once at the start, and lives until everything is done. Given that it&apos;s so large, it should probably be read, used and then dumped in order to free memory.
	&lt;ul&gt;
		&lt;li&gt;The interpolator pickle is large because it contains all the spectra. Presumably that means it contains all the information necessary to reproduce the model spectra, so is it necessary to read all the spectra as well?&lt;/li&gt;
		&lt;li&gt;All the spectra are going into the interpolation, even though many are strongly down-weighted. I suggest using the &lt;tt&gt;neighbours&lt;/tt&gt; parameter of the &lt;tt&gt;RBFInterpolator&lt;/tt&gt;.&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;The calculations in &lt;tt&gt;FitPfsFluxReferenceTask.correctExtinction&lt;/tt&gt; should be pre-computed: E(B-V) translates directly to A_X for each band X given R_X: A_X = R_X * E(B-V). So we can pre-compute the R_X and put it in the broadband photometry reference file.&lt;/li&gt;
	&lt;li&gt;The fitting algorithm seems to be brute-force: it&apos;s mapping out the entire chi^2 space, which means it reads every spectrum, even though many are effectively eliminated by the photometry (e.g., some have a broad-band photometry probability smaller than 10^-200).&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Stepping back from the details of the current implementation, I think that this would go much faster with a modified algorithm:&lt;br/&gt;
1. Fit Teff from broad-band photometry.&lt;br/&gt;
2. Measure logg,m,alpha from line indices. I confess I don&apos;t know exactly how this would work, but I think logg must be a function of the width of Balmer lines (and Paschen lines, if available), and m and alpha must be a function of the equivalent width of different metal lines.&lt;br/&gt;
3. Measure radial velocity using the best guess parameters Teff,logg,m,alpha.&lt;br/&gt;
4. Create an interpolator using the (RV-corrected, LSF-convolved, whitened) spectra within a hyper-sphere of the best guess parameters Teff,logg,m,alpha +/- twice their errors. I&apos;m guessing that linear interpolation between the closest models is sufficient, but an RBF could be used if necessary.&lt;br/&gt;
5. Use a non-linear minimizer (e.g., Powell&apos;s method) with the interpolator to fit the spectrum. I think this should converge fairly quickly; if not, a grid search could be done as currently, but over a much-reduced subset of parameter space.&lt;/p&gt;</comment>
                            <comment id="32309" author="sogo.mineo" created="Sun, 26 Feb 2023 23:45:11 +0000"  >&lt;p&gt;Thanks for the suggestions. I will think about them a few days later, once my urgent task is done.&lt;/p&gt;</comment>
                            <comment id="32353" author="sogo.mineo" created="Mon, 6 Mar 2023 08:20:24 +0000"  >&lt;p&gt;&amp;gt; All the spectra are going into the interpolation, even though many are strongly down-weighted. I suggest using the neighbours parameter of the RBFInterpolator.&lt;/p&gt;

&lt;p&gt;I have not tried it, but I don&apos;t think any parameter will help reduce memory usage. RBFInterpolator needs all the input spectra to be on memory by nature. Yamashita-san said that we might be able to construct&#160;RBFInterpolator every time it is required, from only a few spectra around the initial guess (Teff0, logg0, m0, alpha0) &#8211; if we can find the initial guess accurately.&lt;/p&gt;</comment>
                            <comment id="32354" author="takuji.yamashita" created="Mon, 6 Mar 2023 09:18:20 +0000"  >&lt;p&gt;Thank you for your suggestions about the algorithm! Mineo-san has implemented the cut-off threshold to narrow down the models after broad-band fitting in &lt;a href=&quot;https://pfspipe.ipmu.jp/jira/browse/PIPE2D-1145&quot; title=&quot;Make fitPfsFluxReference.py faster&quot; class=&quot;issue-link&quot; data-issue-key=&quot;PIPE2D-1145&quot;&gt;&lt;del&gt;PIPE2D-1145&lt;/del&gt;&lt;/a&gt;. We can use it for the neighbours parameter. We should try it, probably after the data release this month.&lt;/p&gt;

&lt;p&gt;It is worth a try your idea using line indices and a minimizer. Stabilizing and optimizing the current flux calibration is a priority, but we may want to start a study of your algorithm.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10000">
                    <name>Blocks</name>
                                            <outwardlinks description="blocks">
                                        <issuelink>
            <issuekey id="22927">SIM2D-151</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                            <outwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="23395">PIPE2D-1208</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="23463">PIPE2D-1231</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="23577">PIPE2D-1238</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|zzsw9z:</customfieldvalue>

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