Hello again, I'm again running a very simple script from the cookbook, learning how to use the stellar spectrum generator. It's just a simple tests of spectrum generation with stars of all the same age and mass. It fails with a key error on the dataset, even thought it's not really using the dataset for anything but a reference time (I think). Since it's all small, I'll clip it in below. Here's the script itself:
from yt.mods import * from yt.analysis_modules.star_analysis.api import * ds = load("RD0009")
spec = SpectrumBuilder(ds, bcdir="/Users/hallman/work/data/sfData", model="chabrier")
sm = np.ones(100) ct = np.zeros(100)
spec.calculate_spectrum(star_mass=sm, star_creation_time=ct, star_metallicity_constant=0.02)
spec.write_out(name="spec.out")
And here is the output:
Traceback (most recent call last): File "starSpec.py", line 13, in <module> spec.calculate_spectrum(star_mass=sm, star_creation_time=ct, star_metallicity_constant=0.02) File "/Users/hallman/work/yt-x86_64/src/yt-hg/yt/analysis_modules/star_analysis/sfr_spectrum.py", line 387, in calculate_spectrum dt = (self.time_now - self.star_creation_time * self._ds['Time']) / YEAR File "/Users/hallman/work/yt-x86_64/src/yt-hg/yt/data_objects/static_output.py", line 249, in __getitem__ return self.parameters[key] KeyError: 'Time'
Even if I modify "sfr_spectrum.py" to use the key "current_time", it still fails with the same error. This is with yt-3.0, dataset created with the tip of enzo-dev as of about 20 minutes ago. It fails on older enzo datasets as well with the same error.
Thanks for any help.
Eric
Hi Eric,
Did the load command succeed. I noticed in the code you included that you did ds = load("RD0009") and not ds = load("RD0009/RD0009")
It's not that is it?
Britton
On Wed, Aug 20, 2014 at 5:18 PM, Eric Hallman hallman@txcorp.com wrote:
Hello again, I'm again running a very simple script from the cookbook, learning how to use the stellar spectrum generator. It's just a simple tests of spectrum generation with stars of all the same age and mass. It fails with a key error on the dataset, even thought it's not really using the dataset for anything but a reference time (I think). Since it's all small, I'll clip it in below. Here's the script itself:
from yt.mods import * from yt.analysis_modules.star_analysis.api import * ds = load("RD0009")
spec = SpectrumBuilder(ds, bcdir="/Users/hallman/work/data/sfData", model="chabrier")
sm = np.ones(100) ct = np.zeros(100)
spec.calculate_spectrum(star_mass=sm, star_creation_time=ct, star_metallicity_constant=0.02)
spec.write_out(name="spec.out")
And here is the output:
Traceback (most recent call last): File "starSpec.py", line 13, in <module> spec.calculate_spectrum(star_mass=sm, star_creation_time=ct, star_metallicity_constant=0.02) File "/Users/hallman/work/yt-x86_64/src/yt-hg/yt/analysis_modules/star_analysis/sfr_spectrum.py", line 387, in calculate_spectrum dt = (self.time_now - self.star_creation_time * self._ds['Time']) / YEAR File "/Users/hallman/work/yt-x86_64/src/yt-hg/yt/data_objects/static_output.py", line 249, in __getitem__ return self.parameters[key] KeyError: 'Time'
Even if I modify "sfr_spectrum.py" to use the key "current_time", it still fails with the same error. This is with yt-3.0, dataset created with the tip of enzo-dev as of about 20 minutes ago. It fails on older enzo datasets as well with the same error.
Thanks for any help.
Eric
Eric Hallman Tech-X Corporation hallman@txcorp.com 5621 Arapahoe Ave, Suite A Phone: (720) 254-5833 Boulder, CO 80303 Fax: (303) 448-7756 --
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hey Britton, yes the load command succeeded. I'm in the RD0009 directory. It looks like this:
torque:RD0009 hallman$ python starSpec.py yt : [INFO ] 2014-08-20 12:12:57,202 Parameters: current_time = 228.100098576 yt : [INFO ] 2014-08-20 12:12:57,202 Parameters: domain_dimensions = [32 32 32] yt : [INFO ] 2014-08-20 12:12:57,230 Parameters: domain_left_edge = [ 0. 0. 0.] yt : [INFO ] 2014-08-20 12:12:57,231 Parameters: domain_right_edge = [ 1. 1. 1.] yt : [INFO ] 2014-08-20 12:12:57,232 Parameters: cosmological_simulation = 1 yt : [INFO ] 2014-08-20 12:12:57,232 Parameters: current_redshift = 0.00699900695239 yt : [INFO ] 2014-08-20 12:12:57,232 Parameters: omega_lambda = 0.732 yt : [INFO ] 2014-08-20 12:12:57,232 Parameters: omega_matter = 0.268 yt : [INFO ] 2014-08-20 12:12:57,232 Parameters: hubble_constant = 0.704
On Aug 20, 2014, at 12:30 PM, Britton Smith brittonsmith@gmail.com wrote:
Hi Eric,
Did the load command succeed. I noticed in the code you included that you did ds = load("RD0009") and not ds = load("RD0009/RD0009")
It's not that is it?
Britton
On Wed, Aug 20, 2014 at 5:18 PM, Eric Hallman hallman@txcorp.com wrote: Hello again, I'm again running a very simple script from the cookbook, learning how to use the stellar spectrum generator. It's just a simple tests of spectrum generation with stars of all the same age and mass. It fails with a key error on the dataset, even thought it's not really using the dataset for anything but a reference time (I think). Since it's all small, I'll clip it in below. Here's the script itself:
from yt.mods import * from yt.analysis_modules.star_analysis.api import * ds = load("RD0009")
spec = SpectrumBuilder(ds, bcdir="/Users/hallman/work/data/sfData", model="chabrier")
sm = np.ones(100) ct = np.zeros(100)
spec.calculate_spectrum(star_mass=sm, star_creation_time=ct, star_metallicity_constant=0.02)
spec.write_out(name="spec.out")
And here is the output:
Traceback (most recent call last): File "starSpec.py", line 13, in <module> spec.calculate_spectrum(star_mass=sm, star_creation_time=ct, star_metallicity_constant=0.02) File "/Users/hallman/work/yt-x86_64/src/yt-hg/yt/analysis_modules/star_analysis/sfr_spectrum.py", line 387, in calculate_spectrum dt = (self.time_now - self.star_creation_time * self._ds['Time']) / YEAR File "/Users/hallman/work/yt-x86_64/src/yt-hg/yt/data_objects/static_output.py", line 249, in __getitem__ return self.parameters[key] KeyError: 'Time'
Even if I modify "sfr_spectrum.py" to use the key "current_time", it still fails with the same error. This is with yt-3.0, dataset created with the tip of enzo-dev as of about 20 minutes ago. It fails on older enzo datasets as well with the same error.
Thanks for any help.
Eric
Eric Hallman Tech-X Corporation hallman@txcorp.com 5621 Arapahoe Ave, Suite A Phone: (720) 254-5833 Boulder, CO 80303 Fax: (303) 448-7756 --
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Hi Eric,
Looks to me like it hasn't been updated to use the new units code. This construction:
dt = (self.time_now - self.star_creation_time * self._ds['Time']) / YEAR
shouldn't need to access self._ds['Time'] anymore, nor divide by YEAR. It should look more like:
dt = (self.time_now - self.star_creation_time).in_units("yr")
Can you file a bug?
On Wed, Aug 20, 2014 at 11:18 AM, Eric Hallman hallman@txcorp.com wrote:
Hello again, I'm again running a very simple script from the cookbook, learning how to use the stellar spectrum generator. It's just a simple tests of spectrum generation with stars of all the same age and mass. It fails with a key error on the dataset, even thought it's not really using the dataset for anything but a reference time (I think). Since it's all small, I'll clip it in below. Here's the script itself:
from yt.mods import * from yt.analysis_modules.star_analysis.api import * ds = load("RD0009")
spec = SpectrumBuilder(ds, bcdir="/Users/hallman/work/data/sfData", model="chabrier")
sm = np.ones(100) ct = np.zeros(100)
spec.calculate_spectrum(star_mass=sm, star_creation_time=ct, star_metallicity_constant=0.02)
spec.write_out(name="spec.out")
And here is the output:
Traceback (most recent call last): File "starSpec.py", line 13, in <module> spec.calculate_spectrum(star_mass=sm, star_creation_time=ct, star_metallicity_constant=0.02) File "/Users/hallman/work/yt-x86_64/src/yt-hg/yt/analysis_modules/star_analysis/sfr_spectrum.py", line 387, in calculate_spectrum dt = (self.time_now - self.star_creation_time * self._ds['Time']) / YEAR File "/Users/hallman/work/yt-x86_64/src/yt-hg/yt/data_objects/static_output.py", line 249, in __getitem__ return self.parameters[key] KeyError: 'Time'
Even if I modify "sfr_spectrum.py" to use the key "current_time", it still fails with the same error. This is with yt-3.0, dataset created with the tip of enzo-dev as of about 20 minutes ago. It fails on older enzo datasets as well with the same error.
Thanks for any help.
Eric
Eric Hallman Tech-X Corporation hallman@txcorp.com 5621 Arapahoe Ave, Suite A Phone: (720) 254-5833 Boulder, CO 80303 Fax: (303) 448-7756 --
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
Yes. I'll do that today.
Eric
------------------ Eric Hallman Tech-X Corporation hallman@txcorp.com 5621 Arapahoe Ave, Suite A Boulder, CO 80303 Phone: 720-254-5833 -------------------
On Aug 20, 2014, at 12:31 PM, Matthew Turk matthewturk@gmail.com wrote:
Hi Eric,
Looks to me like it hasn't been updated to use the new units code. This construction:
dt = (self.time_now - self.star_creation_time * self._ds['Time']) / YEAR
shouldn't need to access self._ds['Time'] anymore, nor divide by YEAR. It should look more like:
dt = (self.time_now - self.star_creation_time).in_units("yr")
Can you file a bug?
On Wed, Aug 20, 2014 at 11:18 AM, Eric Hallman hallman@txcorp.com wrote: Hello again, I'm again running a very simple script from the cookbook, learning how to use the stellar spectrum generator. It's just a simple tests of spectrum generation with stars of all the same age and mass. It fails with a key error on the dataset, even thought it's not really using the dataset for anything but a reference time (I think). Since it's all small, I'll clip it in below. Here's the script itself:
from yt.mods import * from yt.analysis_modules.star_analysis.api import * ds = load("RD0009")
spec = SpectrumBuilder(ds, bcdir="/Users/hallman/work/data/sfData", model="chabrier")
sm = np.ones(100) ct = np.zeros(100)
spec.calculate_spectrum(star_mass=sm, star_creation_time=ct, star_metallicity_constant=0.02)
spec.write_out(name="spec.out")
And here is the output:
Traceback (most recent call last): File "starSpec.py", line 13, in <module> spec.calculate_spectrum(star_mass=sm, star_creation_time=ct, star_metallicity_constant=0.02) File "/Users/hallman/work/yt-x86_64/src/yt-hg/yt/analysis_modules/star_analysis/sfr_spectrum.py", line 387, in calculate_spectrum dt = (self.time_now - self.star_creation_time * self._ds['Time']) / YEAR File "/Users/hallman/work/yt-x86_64/src/yt-hg/yt/data_objects/static_output.py", line 249, in __getitem__ return self.parameters[key] KeyError: 'Time'
Even if I modify "sfr_spectrum.py" to use the key "current_time", it still fails with the same error. This is with yt-3.0, dataset created with the tip of enzo-dev as of about 20 minutes ago. It fails on older enzo datasets as well with the same error.
Thanks for any help.
Eric
Eric Hallman Tech-X Corporation hallman@txcorp.com 5621 Arapahoe Ave, Suite A Phone: (720) 254-5833 Boulder, CO 80303 Fax: (303) 448-7756 --
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org