[yt-users] problems with star spectrum generator?

Matthew Turk matthewturk at gmail.com
Wed Aug 20 09:31:47 PDT 2014


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 at 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 at txcorp.com
> 5621 Arapahoe Ave, Suite A       Phone: (720) 254-5833
> Boulder, CO 80303                Fax:   (303) 448-7756
> --
>
>
>
>
>
> _______________________________________________
> 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




More information about the yt-users mailing list