Problem with loading files!

952 views
Skip to first unread message

Sadegh

unread,
Aug 19, 2015, 5:53:48 PM8/19/15
to hyperspy-users
Hi,

I have just started to use hyperspy. I have a problem with load() command. Here is the error I get when trying to load a file:

In [1]: A = load('Au w Cu Agg.rpl').as_spectrum(0)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-fb9bc08721a4> in <module>()
----> 1 A = load('Au w Cu Agg.rpl').as_spectrum(0)

NameError: name 'load' is not defined


Could anybody help me?

Thanks


Tomas Ostasevicius

unread,
Aug 19, 2015, 7:08:08 PM8/19/15
to hypersp...@googlegroups.com
Hi,

Could you describe the system you have (i.e. OS, hyperspy version, and how you installed it)?
There was a change how to start hyperspy since version 0.8.1.
Namely, the hyperspy magic (i.e.  "%hyperspy") has to be run before using any of the functions.

Yet another change is that we will discourage mixing up name-spaces.... Which in simple terms means that in the future you will have to use all hyperspy functions with a "hs." before it - e.g. your line of code will have to be 
A = hs.load("Au w Cu Agg.rpl').as_spectrum(0)

Note that most of the functions, e.g. plotting, will be unaffected, as they are not "general", but functions of the object, in this particular case "A":
A.plot()
would still work as expected.

Tomas

--
You received this message because you are subscribed to the Google Groups "hyperspy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hyperspy-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sadegh

unread,
Aug 20, 2015, 5:58:26 PM8/20/15
to hyperspy-users
Hi Tomas,

Many thanks for the reply.

I've got Windows 7, I downloaded it from http://hyperspy.org/download.html
I've tried with different files and different file names. My colleague who has Hyperspy, but the previous version of it and on his Mac computer, can load the files with no problem.

Here is what I get by a new file name and using hs.load()

In [1]: A = hs.load('AuWCuAgg.rpl').as_spectrum(0)
---------------------------------------------------------------------------

NameError                                 Traceback (most recent call last)
<ipython-input-3-e206e1566e7f> in <module>()
----> 1 A = hs.load('AuWCuAgg.rpl').as_spectrum(0)
 
NameError: name 'hs' is not defined


Thank you for the help,
Sadegh

Tomas Ostasevicius

unread,
Aug 21, 2015, 3:13:53 AM8/21/15
to hyperspy-users
Hi Sadegh,

First thing I'd try is to run the hyperspy magic:

Once the ipython/jupyter interface of your choice (notebook or qtconsole) is opened and fully loaded, run the following:
%hyperspy

If the magic run correctly, you should see some text printed, including hyperspy welcome and a couple of lines of code. Once that is done, please try loading again.

If you get an error that the hyperspy magic is not defined, it means you are most likely using an older version, and I suggest downloading and installing a more recent one (0.8.1 or later)

Best wishes,
Tomas

Sadegh

unread,
Aug 21, 2015, 10:56:03 PM8/21/15
to hyperspy-users
Hi Tomas,

I reinstalled the new version of it and now it is working.

Thanks for the help,
Sadegh
Reply all
Reply to author
Forward
0 new messages