Re: writing PPV cubes with fields other than density
Hi Sam, I believe this is a bug now, but can you try setting the field name as “cell_mass” instead of the tuple in the call to PPVCube as a workaround? Can you file this as an issue at http://github.com/yt-project/yt_astro_analysis/issues with the code and traceback? Thanks, John
On Nov 14, 2018, at 2:46 PM, Samantha M Benincasa
wrote: Hi John,
I believe it does. It shows up in the derived field list and the command for cube creation runs and produces reasonable output.
Cheers, Sam
On Wed, Nov 14, 2018, 11:14 AM John Zuhone
mailto:jzuhone@gmail.com wrote: Hi Sam, I think the issue here is that the Gizmo simulation you are using doesn’t have a “cell_mass” field (someone should correct me if I am missing something but I am pretty sure this is the case). This is only true for grid-based datasets.
You could try using (“deposit”, “PartType0_mass") instead, which will give you the deposited gas mass on the ochre.
We plan to make these things less confusing in yt 4.0.
Best,
John Z
On Nov 14, 2018, at 1:52 PM, Samantha M Benincasa
mailto:smbenincasa@ucdavis.edu> wrote: Hi everyone,
I'm currently using the PPVcube function to make FITS files of a gizmo simulation. I would like the field used to make the cubes to be mass rather than density. The cube is created however, when I try to write the cube, I get the error copied below. I included the code directly before it.
Is it not possible to write FITS cubes with other fields?
Cheers, Sam
cubeL = PPVCube(ds, L, ("gas","cell_mass"), (-150.,150.,6,"km/s"), dim s=100, method="sum", center=c,width=(0.01, "Mpc"), data_source=sp)
cubeL.write_fits("mass.fits",length_unit="kpc", clobber='True')--------------------------------------------------------------------
------- KeyError Traceback (most recent cal l last) <ipython-input-9-4e7ff69a0d0f> in <module>() ----> 1 cubeL.write_fits("mass.fits",length_unit="kpc", clobber='Tru e') /anaconda2/lib/python2.7/site-packages/yt/utilities/parallel_tools/p arallel_analysis_interface.pyc in root_only(*args, **kwargs) 317
318
--> 319
320 321
def root_only(*args, **kwargs): if not parallel_capable: return func(*args, **kwargs) comm = _get_comm(args) rv = None /anaconda2/lib/python2.7/site-packages/yt/analysis_modules/ppv_cube/ ppv_cube.pyc in write_fits(self, filename, overwrite, length_unit, s ky_scale, sky_center, **kwargs) 313
314
--> 315
317 fib.update_all_headers("btype", self.field)
/anaconda2/lib/python2.7/site-packages/yt/visualization/fits_image.p yc in __init__(self, data, fields, units, width, wcs) w.wcs.ctype = ["LINEAR","LINEAR",vtype] fib = FITSImageData(self.data.transpose(), fields=se fib.update_all_headers("bunit", re.sub('()', '', str (self.proj_units))) lf.field, wcs=w)316
158
159
--> 160
161
eld].units)162
KeyError: 'cell_mass'
_______________________________________________ yt-users mailing list -- yt-users@python.org mailto:yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org mailto:yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org mailto:yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org mailto:yt-users-leave@python.org _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Hi John,
You're right, using only "cell_mass" instead of ("gas","cell_mass") does the trick! Does this still use only the gas mass though?
Either way, I've also submitted the issue as suggested.
Cheers,
Sam
On Wed, 14 Nov 2018 at 11:56, John Zuhone
participants (2)
-
John Zuhone
-
Samantha M Benincasa