<div dir="ltr"><div>Hi Lucas,</div><div><br></div><div>Thank you, your advice worked perfectly!</div><div><br></div><div>Ian<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 3, 2024 at 10:12 AM Lucas Wilkins - STFC UKRI <<a href="mailto:lucas.wilkins@stfc.ac.uk">lucas.wilkins@stfc.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-5861724626314033771">
<div dir="ltr">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
sas is the main package of sasview. I think that line should not be there.</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
In latest version of sasmodels/data.py it isn't there:</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<pre style="background-color:rgb(43,43,43)"><div style="font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(169,183,198)"><br></span><span style="color:rgb(204,120,50)">import </span><span style="color:rgb(169,183,198)">numpy </span><span style="color:rgb(204,120,50)">as </span><span style="color:rgb(169,183,198)">np </span><span style="color:rgb(128,128,128)"># type: ignore</span></div><div style="font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(204,120,50)">from </span><span style="color:rgb(169,183,198)">numpy </span><span style="color:rgb(204,120,50)">import </span><span style="color:rgb(169,183,198)">sqrt</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(169,183,198)">sin</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(169,183,198)">cos</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(169,183,198)">pi</span></div><div style="font-family:"JetBrains Mono",monospace;font-size:9.8pt"><span style="color:rgb(169,183,198)"><br></span><span style="color:rgb(128,128,128)"># pylint: disable=unused-import<br></span><span style="color:rgb(204,120,50)">try</span><span style="color:rgb(169,183,198)">:<br> </span><span style="color:rgb(204,120,50)">from </span><span style="color:rgb(169,183,198)">typing </span><span style="color:rgb(204,120,50)">import </span><span style="color:rgb(169,183,198)">Union</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(169,183,198)">Dict</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(169,183,198)">List</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(169,183,198)">Optional</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(169,183,198)">Tuple</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(169,183,198)">Callable<br> Data = Union[</span><span style="color:rgb(106,135,89)">"Data1D"</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(106,135,89)">"Data2D"</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(106,135,89)">"SesansData"</span><span style="color:rgb(169,183,198)">]</span></div></pre>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Try cloning the latest sasmodels (and sasdata)?</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="m_-5861724626314033771appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_-5861724626314033771divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> users <<a href="mailto:users-bounces@lists.sasview.org" target="_blank">users-bounces@lists.sasview.org</a>> on behalf of Ian Billinge via users <<a href="mailto:users@lists.sasview.org" target="_blank">users@lists.sasview.org</a>><br>
<b>Sent:</b> 03 June 2024 15:02<br>
<b>To:</b> <a href="mailto:users@lists.sasview.org" target="_blank">users@lists.sasview.org</a> <<a href="mailto:users@lists.sasview.org" target="_blank">users@lists.sasview.org</a>><br>
<b>Subject:</b> [SasView Users] Cannot find 'sas' module in sasmodels package</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hello everyone,</div>
<div><br>
</div>
<div>I am trying to run the <a href="https://www.sasview.org/docs/user/qtgui/Perspectives/Fitting/scripting.html" target="_blank">
scripting tutorial</a>, and I am unable to run the code because I can't import the 'sas' package.
<br>
</div>
<div><br>
</div>
<div>When I run the import statements at the top of the tutorial, i.e.</div>
<div><span style="font-family:monospace"><br>
</span></div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span style="font-family:monospace">import sys<br>
from bumps.names import *<br>
from sasmodels.core import load_model<br>
from sasmodels.bumps_model import Model, Experiment<br>
from sasmodels.data import load_data, set_beam_stop, set_top</span></blockquote>
<div><br>
</div>
<div>I get <br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span style="font-family:monospace">---------------------------------------------------------------------------<br>
ModuleNotFoundError Traceback (most recent call last)<br>
Cell In[9], line 4<br>
2 from bumps.names import *<br>
3 from sasmodels.core import load_model<br>
----> 4 from sasmodels.bumps_model import Model, Experiment<br>
5 from sasmodels.data import load_data, set_beam_stop, set_top<br>
<br>
File ~/micromamba/envs/smi_py311/lib/python3.11/site-packages/sasmodels/bumps_model.py:20<br>
16 __all__ = ["Model", "Experiment", "BumpsParameter"]<br>
18 import numpy as np # type: ignore<br>
---> 20 from .data import plot_theory<br>
21 from .direct_model import DataMixin<br>
23 # pylint: disable=unused-import<br>
<br>
File ~/micromamba/envs/smi_py311/lib/python3.11/site-packages/sasmodels/data.py:39<br>
37 import numpy as np # type: ignore<br>
38 from numpy import sqrt, sin, cos, pi<br>
---> 39 import sas<br>
40 # pylint: disable=unused-import<br>
41 try:<br>
<br>
ModuleNotFoundError: No module named 'sas'</span></blockquote>
<div><br>
</div>
<div>
<div>I apparently have sasmodels installed, since I can successfully import <span style="font-family:monospace">
load_model </span>from sasmodels<span style="font-family:monospace">.core</span>. However, it seems I am missing the
<span style="font-family:monospace">sas</span> package. I have searched online and wasn't able to find any such package. I ran a simple
<span style="font-family:monospace">pip install sas</span>, and indeed, something downloaded, but it didn't resolve the issue.</div>
<div><br>
</div>
<div>Any insights on the issue would be most appreciated.</div>
<div><br>
</div>
<div>Best, <br>
</div>
<div><br>
</div>
<div>Ian Billinge<br>
</div>
<div><span>-- </span><br>
<div dir="ltr">
<div dir="ltr">
<div>Ian Billinge</div>
<div><i>he/him/his</i></div>
<div>Ph.D Student, Yip Lab</div>
<div>Dept. of Earth & Environmental Engineering</div>
<div>Fu Foundation School of Engineering</div>
<div>Columbia University in the City of New York<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Ian Billinge</div><div><i>he/him/his</i></div><div>Ph.D Student, Yip Lab</div><div>Dept. of Earth & Environmental Engineering</div><div>Fu Foundation School of Engineering</div><div>Columbia University in the City of New York<br></div></div></div>