[yt-users] problem with units

alex volioths alex-volos at hotmail.com
Wed Sep 2 01:55:14 PDT 2015


Hello John,
I followed your instructions and run the script from the terminal but I still get this error message:
YTUnitOperationError                      Traceback (most recent call last)/home/afi/Documents/X_ray_sim/X_mock.py in <module>()     74      75 photons = PhotonList.from_scratch(sphere, redshift, A,---> 76                                   exp_time, thermal_model, center="c")     77      78 
/home/afi/miniconda/lib/python2.7/site-packages/yt/analysis_modules/photon_simulator/photon_simulator.pyc in from_scratch(cls, data_source, redshift, area, exp_time, photon_model, parameters, center, dist, cosmology)    328         parameters["Width"] = 2.*width.in_units("kpc")    329 --> 330         photons = photon_model(data_source, parameters)    331     332         mylog.info("Finished generating photons.")
/home/afi/miniconda/lib/python2.7/site-packages/yt/analysis_modules/photon_simulator/photon_models.pyc in __call__(self, data_source, parameters)    138             idxs = np.argsort(kT)    139 --> 140             kT_bins = np.linspace(kT_min, max(my_kT_max, kT_max), num=n_kT+1)    141             dkT = kT_bins[1]-kT_bins[0]    142             kT_idxs = np.digitize(kT[idxs], kT_bins)
/home/afi/miniconda/lib/python2.7/site-packages/numpy/core/function_base.pyc in linspace(start, stop, num, endpoint, retstep, dtype)     96         if num == 1:     97             return array([start], dtype=dtype)---> 98         step = (stop-start)/float((num-1))     99         y = _nx.arange(0, num, dtype=dtype) * step + start    100         y[-1] = stop
/home/afi/miniconda/lib/python2.7/site-packages/yt/units/yt_array.pyc in __sub__(self, right_object)    743     744         """--> 745         ro = sanitize_units_add(self, right_object, "subtraction")    746         return YTArray(super(YTArray, self).__sub__(ro))    747 
/home/afi/miniconda/lib/python2.7/site-packages/yt/units/yt_array.pyc in sanitize_units_add(this_object, other_object, op_string)    132     else:    133         if not inp.units.is_dimensionless:--> 134             raise YTUnitOperationError(op_string, inp.units, dimensionless)    135     return ret    136 
YTUnitOperationError: The subtraction operator for YTArrays with units (keV) and (1) is not well defined.
CheersAlex
From: jzuhone at gmail.com
Date: Tue, 1 Sep 2015 11:41:30 -0400
To: yt-users at lists.spacepope.org
Subject: Re: [yt-users] problem with units

Hi Alex,
It appears that Conda is not recognizing the development version as newer than yours. I’ll need to look into why that is, but in the meantime you can do the following:
conda remove ytconda install -c https://conda.binstar.org/jzuhone/channel/dev yt
This should take care of it—if not, let me know.
Best,
John
On Sep 1, 2015, at 11:34 AM, alex volioths <alex-volos at hotmail.com> wrote:Hello John,
I decided to upgrade now to give some feedback that could be useful.

After the update command I get:
Fetching package metadata: ......Solving package specifications: .# All requested packages already installed.# packages in environment at /home/afi/miniconda:#yt                        3.2                  np19py27_0
when I run the script from the terminal and not from spyder I get this warning:
YTUnitOperationError                      Traceback (most recent call last)/home/afi/Documents/X_ray_sim/X_mock.py in <module>()     73      74 photons = PhotonList.from_scratch(sphere, redshift, A,---> 75                                   exp_time, thermal_model, center="c")     76      77 
/home/afi/miniconda/lib/python2.7/site-packages/yt/analysis_modules/photon_simulator/photon_simulator.pyc in from_scratch(cls, data_source, redshift, area, exp_time, photon_model, parameters, center, dist, cosmology)    328         parameters["Width"] = 2.*width.in_units("kpc")    329 --> 330         photons = photon_model(data_source, parameters)    331     332         mylog.info("Finished generating photons.")
/home/afi/miniconda/lib/python2.7/site-packages/yt/analysis_modules/photon_simulator/photon_models.pyc in __call__(self, data_source, parameters)    138             idxs = np.argsort(kT)    139 --> 140             kT_bins = np.linspace(kT_min, max(my_kT_max, kT_max), num=n_kT+1)    141             dkT = kT_bins[1]-kT_bins[0]    142             kT_idxs = np.digitize(kT[idxs], kT_bins)
/home/afi/miniconda/lib/python2.7/site-packages/numpy/core/function_base.pyc in linspace(start, stop, num, endpoint, retstep, dtype)     96         if num == 1:     97             return array([start], dtype=dtype)---> 98         step = (stop-start)/float((num-1))     99         y = _nx.arange(0, num, dtype=dtype) * step + start    100         y[-1] = stop
/home/afi/miniconda/lib/python2.7/site-packages/yt/units/yt_array.pyc in __sub__(self, right_object)    743     744         """--> 745         ro = sanitize_units_add(self, right_object, "subtraction")    746         return YTArray(super(YTArray, self).__sub__(ro))    747 
/home/afi/miniconda/lib/python2.7/site-packages/yt/units/yt_array.pyc in sanitize_units_add(this_object, other_object, op_string)    132     else:    133         if not inp.units.is_dimensionless:--> 134             raise YTUnitOperationError(op_string, inp.units, dimensionless)    135     return ret    136 
YTUnitOperationError: The subtraction operator for YTArrays with units (keV) and (1) is not well defined.

RegardsAlex
From: jzuhone at gmail.com
Date: Tue, 1 Sep 2015 09:35:20 -0400
To: yt-users at lists.spacepope.org
Subject: Re: [yt-users] problem with units

Hi Alex,
Ok, so this actually makes things a bit simpler. You have one of two options. 
You can install one of our nightly development packages. The upside to this is that you will get the bugfix that was recently applied. The downside to this is that you will also get experimental changes that have been merged in lately, which may be unstable. 
If you want to install this version, you can use this command: 
conda install -c https://conda.binstar.org/jzuhone/channel/dev yt
which will update you to last night’s development version. 
Alternatively, we will be updating the stable conda package with a bugfix release very soon (maybe in the next week or so), so if you want you can wait for that and I will be sure to let you know when it comes out. 
Best,
John
On Sep 1, 2015, at 3:23 AM, alex volioths <alex-volos at hotmail.com> wrote:Hi John, 

thank you for your time and help. 

I used conda to install yt.
I am using Ubuntu  14 LTS but I am a newbie. 

Again, thank you.
Alex 

From: jzuhone at gmail.com
Date: Mon, 31 Aug 2015 17:49:51 -0400
To: yt-users at lists.spacepope.org
Subject: Re: [yt-users] problem with units

Hi Alex,
Sorry—the delays on my end are longer than yours. 
We’ve fixed this bug, but I’m still a little unclear as to how you installed yt. 
You’re using spyder to run the script, but I don’t think you can install yt using spyder, so you must have used “pip install yt” to install it, or maybe you installed it from source. Do you remember how you did it?
Also, is this Linux or Mac OS X?
Best,
John
On Aug 29, 2015, at 1:28 PM, alex volioths <alex-volos at hotmail.com> wrote:Hi John,

I am sorry for the late reply.

I use spyder which   comes with  modules installed.

Thank you for your help!
Alex

From: jzuhone at gmail.com
Date: Wed, 26 Aug 2015 17:50:44 -0400
To: yt-users at lists.spacepope.org
Subject: Re: [yt-users] problem with units

Alex, 
My apologies—this is a bug in the code. I have a fix, which I hope to have ready by tonight or tomorrow.
Just a quick question—how did you install yt? It looks like your Python stack is in /usr/local. 
Best,
John
On Aug 26, 2015, at 3:26 AM, alex volioths <alex-volos at hotmail.com> wrote:Hello John
I am using spyder to run the script. Spyder is using the 1.8.2 version.
CheersAlex
From: jzuhone at gmail.com
Date: Tue, 25 Aug 2015 09:54:31 -0400
To: yt-users at lists.spacepope.org
Subject: Re: [yt-users] problem with units

Hi Alex,
Sorry for the trouble--I'll see if I can figure out what's gone wrong on this end.
It looks like you're running yt 3.2--can you tell me what version of NumPy you are running?
Best,
John

John ZuHone
Kavli Center for Astrophysics and Space Research
Massachusetts Institute of Technology
77 Massachusetts Ave., 37-582G
Cambridge, MA 02139
(w) 617-253-2354
(m) 781-708-5004
jzuhone at space.mit.edu
jzuhone at gmail.com
http://www.jzuhone.com
On Aug 25, 2015, at 9:41 AM, alex volioths <alex-volos at hotmail.com> wrote:

Hello everyone,
I've been practicing with the example "Creating a X-ray observation from an in-memory dataset" from here http://yt-project.org/doc/analyzing/analysis_modules/photon_simulator.html 
However even with simple copy and paste after defining the photons I get this error message:


File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 685, in runfile
execfile(filename, namespace)


File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 78, in execfile
builtins.execfile(filename, *where)


File "/home/afi/Documents/X_ray_sim/X_mock.py", line 75, in <module>
exp_time, thermal_model, center="c")


File "/usr/local/lib/python2.7/dist-packages/yt-3.2-py2.7-linux-x86_64.egg/yt/analysis_modules/photon_simulator/photon_simulator.py", line 330, in from_scratch
photons = photon_model(data_source, parameters)


File "/usr/local/lib/python2.7/dist-packages/yt-3.2-py2.7-linux-x86_64.egg/yt/analysis_modules/photon_simulator/photon_models.py", line 140, in __call__
kT_bins = np.linspace(kT_min, max(my_kT_max, kT_max), num=n_kT+1)


File "/usr/lib/python2.7/dist-packages/numpy/core/function_base.py", line 87, in linspace
step = (stop-start)/float((num-1))


File "/usr/local/lib/python2.7/dist-packages/yt-3.2-py2.7-linux-x86_64.egg/yt/units/yt_array.py", line 745, in __sub__
ro = sanitize_units_add(self, right_object, "subtraction")


File "/usr/local/lib/python2.7/dist-packages/yt-3.2-py2.7-linux-x86_64.egg/yt/units/yt_array.py", line 134, in sanitize_units_add
raise YTUnitOperationError(op_string, inp.units, dimensionless)


YTUnitOperationError: The subtraction operator for YTArrays with units (keV) and (1) is not well defined.


Any ideas? I am new to yt and i can't see something wrong.


Thnak you
Alex
_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

_______________________________________________ yt-users mailing list yt-users at lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org_______________________________________________yt-users mailing listyt-users at lists.spacepope.orghttp://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

_______________________________________________ yt-users mailing list yt-users at lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org_______________________________________________yt-users mailing listyt-users at lists.spacepope.orghttp://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

_______________________________________________ yt-users mailing list yt-users at lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org_______________________________________________yt-users mailing listyt-users at lists.spacepope.orghttp://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

_______________________________________________ yt-users mailing list yt-users at lists.spacepope.orghttp://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org_______________________________________________yt-users mailing listyt-users at lists.spacepope.orghttp://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

_______________________________________________
yt-users mailing list
yt-users at lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20150902/aeda7dad/attachment.htm>


More information about the yt-users mailing list