<div dir="ltr"><div><div><div>Dear Yt users,<br><br></div>I want to the off axis slice plot of density. But I didn't understand the use of north_vector. We already gave the normal vector to the plane and the point and these two things are enough to write a plane equation. I think I am confused with the concept. Please help me in understanding it very well.<br><br><br></div>I am facing one more problem. I want the dark matter density Sliceplot. But when I used the field "dark_matter_density", it's not giving the correct plot I think. Here I attach the plot also for your reference. (check2.png)<br><br><br></div>Then I searched and got that it can also be done if I plot the particle_density so I define field like this as given in yt-doc. <br><div><pre><span class="gmail-k">def</span> <span class="gmail-nf">particle_density</span><span class="gmail-p">(</span><span class="gmail-n">field</span><span class="gmail-p">,</span> <span class="gmail-n">data</span><span class="gmail-p">):</span>
<span class="gmail-n">pos</span> <span class="gmail-o">=</span> <span class="gmail-n">data</span><span class="gmail-p">[</span><span class="gmail-n">ptype</span><span class="gmail-p">,</span> <span class="gmail-n">coord_name</span><span class="gmail-p">]</span>
<span class="gmail-n">mass</span> <span class="gmail-o">=</span> <span class="gmail-n">data</span><span class="gmail-p">[</span><span class="gmail-n">ptype</span><span class="gmail-p">,</span> <span class="gmail-n">mass_name</span><span class="gmail-p">]</span>
<span class="gmail-n">pos</span><span class="gmail-o">.</span><span class="gmail-n">convert_to_units</span><span class="gmail-p">(</span><span class="gmail-s">"code_length"</span><span class="gmail-p">)</span>
<span class="gmail-n">mass</span><span class="gmail-o">.</span><span class="gmail-n">convert_to_units</span><span class="gmail-p">(</span><span class="gmail-s">"code_mass"</span><span class="gmail-p">)</span>
<span class="gmail-n">d</span> <span class="gmail-o">=</span> <span class="gmail-n">data</span><span class="gmail-o">.</span><span class="gmail-n">deposit</span><span class="gmail-p">(</span><span class="gmail-n">pos</span><span class="gmail-p">,</span> <span class="gmail-p">[</span><span class="gmail-n">data</span><span class="gmail-p">[</span><span class="gmail-n">ptype</span><span class="gmail-p">,</span> <span class="gmail-n">mass_name</span><span class="gmail-p">]],</span> <span class="gmail-n">method</span> <span class="gmail-o">=</span> <span class="gmail-s">"sum"</span><span class="gmail-p">)</span>
<span class="gmail-n">d</span> <span class="gmail-o">=</span> <span class="gmail-n">data</span><span class="gmail-o">.</span><span class="gmail-n">ds</span><span class="gmail-o">.</span><span class="gmail-n">arr</span><span class="gmail-p">(</span><span class="gmail-n">d</span><span class="gmail-p">,</span> <span class="gmail-s">"code_mass"</span><span class="gmail-p">)</span>
<span class="gmail-n">d</span> <span class="gmail-o">/=</span> <span class="gmail-n">data</span><span class="gmail-p">[</span><span class="gmail-s">"index"</span><span class="gmail-p">,</span> <span class="gmail-s">"cell_volume"</span><span class="gmail-p">]</span>
<span class="gmail-k">return</span> <span class="gmail-n">d</span>
</pre>but this also give an error says :<br><b><span class="gmail-tL8wMe gmail-EMoHub" id="gmail-:8g.co" style="text-align:left" dir="ltr">NameError: global name 'ptype' is not defined<br><br></span></b></div><div><b><span class="gmail-tL8wMe gmail-EMoHub" id="gmail-:8g.co" style="text-align:left" dir="ltr">but "all_density" field is working fine. </span></b><span class="gmail-tL8wMe gmail-EMoHub" id="gmail-:8g.co" style="text-align:left" dir="ltr">But it will be total density (dark + baryon</span><span class="gmail-tL8wMe gmail-EMoHub" id="gmail-:8g.co" style="text-align:left" dir="ltr"></span><b><span class="gmail-tL8wMe gmail-EMoHub" id="gmail-:8g.co" style="text-align:left" dir="ltr">)<br></span></b></div><div>Please help me regarding this issue.<br><br></div><div><br><br><br><span class="gmail-tL8wMe gmail-EMoHub" id="gmail-:8g.co" style="text-align:left" dir="ltr">Thanks in advance.<br></span></div><div><span class="gmail-tL8wMe gmail-EMoHub" id="gmail-:8g.co" style="text-align:left" dir="ltr"><br></span></div><div><span class="gmail-tL8wMe gmail-EMoHub" id="gmail-:8g.co" style="text-align:left" dir="ltr">Prateek Gupta.<br></span></div></div>