Hi, Everybody!
Does anyone out there have a technique for getting the variance out of
a profile object? A profile object is good at getting <X> vs. B, I'd
then like to get < (X - <X>)^2 > vs B. Matt and I had spittballed the
possibility some time ago, but I was wondering if anyone out there had
successfully done it.
Thanks,
d.
--
Sent from my computer.
Hi,
I'm looking to convert particle based quantities into a uniform grid based
quantity (arepo data is input). So say I have a collection of gas elements
with some density rho and x,y,z positions. I want to construct an 256^3
mesh representing the cells in a mesh.
x,y,z,rho --> cic mesh where the values at i,j,k is the smoothed density
are created by the cic algorithm
Now, generalising this more, can I have rho to be any quantity? So now say
I have star particles which similarly have x,y,z but I want to distribute
their luminosity. Again, I want to do it for say the gas velocity field as
well. Is there any general functionality for converting particle quantities
to mesh quantites in yt with the deposit all_cic functionality? I have a
basic code for just x,y,z particle data and distributing that based on
density to a cic (see below)
ad = pf.all_data()
level = int(math.log(ndim,2))
cg = pf.covering_grid(level=level, left_edge=[0,0,0],dims=[ndim,ndim,ndim])
arr = cg['deposit', 'all_cic'],
but I'm not sure what to do for the other variables. Any help is
appreciated in advance.
Thanks.
Brendan
Dear all,
I am trying to figure out a way to mask out cells that contain shocks. One
way I can think of is to create a derived field by identifying shocks. It
seems that there are different ways of finding shocks: Enzo has a
refinement criterion (refine by shocks) and there is also shock finding
written by Sam.
Has anybody tried to find shocks using yt? I would appreciate it if you
would like to share your code/experience/advice. Thank you!
Yuan
Hi, Everybody--
I'm looking to find a way to change the units on the x- and y-axes for a
projection. Is it possible to do that directly on the plot window or
projection object? Or, is it possible to make an arbitrary unit conversion
once a dataset has been loaded?
Thanks!
d.
--
-- Sent from a computer.
Hi All,
I have a question regarding projection plot colormaps that maybe someone
can answer. I plot temperature data for combustion simulations, with
temperature in the flame ranging from 3200K - 5500K and temperature outside
of the flame ranging from 300K to 1000K. I want to generate projection
plots using two different colormaps, one for the flame and one for outside
of it.
I have been using kamae_r for the whole range 300 – 5500, but I lose
resolution in both the flame and unburned gas regions because of the large
range of my colorscale. Since none of my computational cells have a
temperature in the intermediate region, 1000 – 3200, I want to make plots
with two separate colormaps, or one colormap that combines two fully
resolved colormaps for those temperature intervals, to show my data more
clearly.
I have been playing around with making a custom colormap by working
directly with matplotlib (using the LinearSegmentedColormap function), but
it is very difficult to get the resolution correct when setting the color
intervals and interpolation by hand.
Any advice is appreciated!
Hi Nathan,
halo.data_object... does indeed work.
Thanks for the help,
Ari
On Thu, Jun 25, 2015 at 11:31 AM, <yt-users-request(a)lists.spacepope.org>
wrote:
> Send yt-users mailing list submissions to
> yt-users(a)lists.spacepope.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> or, via email, send a message with subject or body 'help' to
> yt-users-request(a)lists.spacepope.org
>
> You can reach the person managing the list at
> yt-users-owner(a)lists.spacepope.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of yt-users digest..."
>
>
> Today's Topics:
>
> 1. Re: adding quantities to halo catalogs (Britton Smith)
> (Professor Maller)
> 2. Re: adding quantities to halo catalogs (Britton Smith)
> (Nathan Goldbaum)
> 3. Re: convert arbitrary particle based quantities to
> cloud-in-cell mesh (Britton Smith)
> 4. Re: convert arbitrary particle based quantities to
> cloud-in-cell mesh (Nathan Goldbaum)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 24 Jun 2015 18:22:36 -0400
> From: Professor Maller <amaller(a)citytech.cuny.edu>
> To: yt-users(a)lists.spacepope.org
> Subject: Re: [yt-users] adding quantities to halo catalogs (Britton
> Smith)
> Message-ID:
> <CACCSjdP92HhV0X+p1B_LtZ556UgbZnFUvYXuRE=+
> n-n55w1Kmg(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Britton,
>
> Thanks for the help. I'm getting an error trying to use
> halo.data_container.
> 14 hc.add_callback("sphere",factor=1.0)
> 15 def _gas_mass(halo):
> ---> 16 return
> halo.data_container.quantities.total_quantity("cell_mass")
> 17
> 18 add_quantity("gas_mass",_gas_mass)
>
> AttributeError: 'Halo' object has no attribute 'data_container'
>
> I've made my code very simple and am using the example data to debug this.
> I'm just trying to get the total gas mass for now
>
> data_ds = yt.load('Enzo_64/RD0006/RedshiftOutput0006')
> halos_ds = yt.load('rockstar_halos/halos_0.0.bin')
>
> def _gas_mass(halo):
> return halo.data_container.quantities.total_quantity("cell_mass")
>
> add_quantity("gas_mass",_gas_mass)
>
> # Instantiate a catalog using those two paramter files
> hc = HaloCatalog(data_ds=data_ds, halos_ds=halos_ds)
>
> hc.add_callback("sphere",factor=1.0)
> hc.add_quantity("gas_mass")
> hc.create()
>
> Any help would be appreciated.
>
> Thanks,
>
> Ari
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/201…
> >
>
> ------------------------------
>
> Message: 2
> Date: Wed, 24 Jun 2015 15:28:29 -0700
> From: Nathan Goldbaum <nathan12343(a)gmail.com>
> To: Discussion of the yt analysis package
> <yt-users(a)lists.spacepope.org>
> Subject: Re: [yt-users] adding quantities to halo catalogs (Britton
> Smith)
> Message-ID:
> <CAJXewOnrqCSmYcKv3A-tcnXnmzip22OD8s0KUCotXZ=
> 5zKTYmw(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> On Wed, Jun 24, 2015 at 3:22 PM, Professor Maller <
> amaller(a)citytech.cuny.edu
> > wrote:
>
> > Hi Britton,
> >
> > Thanks for the help. I'm getting an error trying to use
> > halo.data_container.
> > 14 hc.add_callback("sphere",factor=1.0)
> > 15 def _gas_mass(halo):
> > ---> 16 return
> > halo.data_container.quantities.total_quantity("cell_mass")
> > 17
> > 18 add_quantity("gas_mass",_gas_mass)
> >
> > AttributeError: 'Halo' object has no attribute 'data_container'
> >
> > I've made my code very simple and am using the example data to debug
> this.
> > I'm just trying to get the total gas mass for now
> >
> > data_ds = yt.load('Enzo_64/RD0006/RedshiftOutput0006')
> > halos_ds = yt.load('rockstar_halos/halos_0.0.bin')
> >
> > def _gas_mass(halo):
> > return halo.data_container.quantities.total_quantity("cell_mass")
> >
>
> Looking at the code, I think this should be "halo.data_object". You can see
> the code for the halo_sphere callback in
> yt/analysis_modules/halo_analysis/halo_callbacks.py, which might be helpful
> to look at when debugging issues like this.
>
>
> >
> > add_quantity("gas_mass",_gas_mass)
> >
> > # Instantiate a catalog using those two paramter files
> > hc = HaloCatalog(data_ds=data_ds, halos_ds=halos_ds)
> >
> > hc.add_callback("sphere",factor=1.0)
> > hc.add_quantity("gas_mass")
> > hc.create()
> >
> > Any help would be appreciated.
> >
> > Thanks,
> >
> > Ari
> >
> > _______________________________________________
> > yt-users mailing list
> > yt-users(a)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/201…
> >
>
> ------------------------------
>
> Message: 3
> Date: Thu, 25 Jun 2015 10:54:43 +0100
> From: Britton Smith <brittonsmith(a)gmail.com>
> To: Discussion of the yt analysis package
> <yt-users(a)lists.spacepope.org>
> Subject: Re: [yt-users] convert arbitrary particle based quantities to
> cloud-in-cell mesh
> Message-ID:
> <CABfs61nm=UCqsA=
> 38zS4_Jv+-LvDcKdi7d3BS34J-scCLFJg8Q(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Brendan,
>
> I would have a look in the yt source in yt/fields/particle_fields.py at the
> field functions like particle_mass and particle_cic. They are good
> examples of just how the deposited fields are done. In addition, there is
> a field function, _get_density_weighted_deposit_field, for doing
> mass-weighted deposited fields. I think this is exactly what you're
> looking for. In fact, it seems that mass-weighted velocity fields already
> exist as something like ("deposit", "<PTYPE>_sum_velocity_x") or
> ("deposit", "<PTYPE>_nn_velocity_x"). If you have multiple particle types
> for stars and such, they should already be defined with these fields. This
> should give you a template for implementing any other fields of this type.
>
> Britton
>
> On Wed, Jun 24, 2015 at 12:28 PM, Brendan Griffen <
> brendan.f.griffen(a)gmail.com> wrote:
>
> > Hi,
> >
> > I'm looking to convert particle based quantities into a uniform grid
> based
> > quantity (arepo data is input). So say I have a collection of gas
> elements
> > with some density rho and x,y,z positions. I want to construct an 256^3
> > mesh representing the cells in a mesh.
> >
> > x,y,z,rho --> cic mesh where the values at i,j,k is the smoothed density
> > are created by the cic algorithm
> >
> > Now, generalising this more, can I have rho to be any quantity? So now
> say
> > I have star particles which similarly have x,y,z but I want to distribute
> > their luminosity. Again, I want to do it for say the gas velocity field
> as
> > well. Is there any general functionality for converting particle
> quantities
> > to mesh quantites in yt with the deposit all_cic functionality? I have a
> > basic code for just x,y,z particle data and distributing that based on
> > density to a cic (see below)
> >
> > ad = pf.all_data()
> > level = int(math.log(ndim,2))
> > cg = pf.covering_grid(level=level,
> left_edge=[0,0,0],dims=[ndim,ndim,ndim])
> > arr = cg['deposit', 'all_cic'],
> >
> > but I'm not sure what to do for the other variables. Any help is
> > appreciated in advance.
> >
> > Thanks.
> > Brendan
> >
> > _______________________________________________
> > yt-users mailing list
> > yt-users(a)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/201…
> >
>
> ------------------------------
>
> Message: 4
> Date: Thu, 25 Jun 2015 08:31:48 -0700
> From: Nathan Goldbaum <nathan12343(a)gmail.com>
> To: Discussion of the yt analysis package
> <yt-users(a)lists.spacepope.org>
> Subject: Re: [yt-users] convert arbitrary particle based quantities to
> cloud-in-cell mesh
> Message-ID:
> <
> CAJXewOkuA2QTS+qas+VsEzKLD_ZUvh-ie88n-NjvQqRtPCkWpA(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> In the latest dev version of yt, there is a ds.add_deposited_particle_field
> function attached to all dataset instances that automates the workflow
> Britton suggests.
>
> On Thursday, June 25, 2015, Britton Smith <brittonsmith(a)gmail.com> wrote:
>
> > Hi Brendan,
> >
> > I would have a look in the yt source in yt/fields/particle_fields.py at
> > the field functions like particle_mass and particle_cic. They are good
> > examples of just how the deposited fields are done. In addition, there
> is
> > a field function, _get_density_weighted_deposit_field, for doing
> > mass-weighted deposited fields. I think this is exactly what you're
> > looking for. In fact, it seems that mass-weighted velocity fields
> already
> > exist as something like ("deposit", "<PTYPE>_sum_velocity_x") or
> > ("deposit", "<PTYPE>_nn_velocity_x"). If you have multiple particle
> types
> > for stars and such, they should already be defined with these fields.
> This
> > should give you a template for implementing any other fields of this
> type.
> >
> > Britton
> >
> > On Wed, Jun 24, 2015 at 12:28 PM, Brendan Griffen <
> > brendan.f.griffen(a)gmail.com
> > <javascript:_e(%7B%7D,'cvml','brendan.f.griffen(a)gmail.com');>> wrote:
> >
> >> Hi,
> >>
> >> I'm looking to convert particle based quantities into a uniform grid
> >> based quantity (arepo data is input). So say I have a collection of gas
> >> elements with some density rho and x,y,z positions. I want to construct
> an
> >> 256^3 mesh representing the cells in a mesh.
> >>
> >> x,y,z,rho --> cic mesh where the values at i,j,k is the smoothed density
> >> are created by the cic algorithm
> >>
> >> Now, generalising this more, can I have rho to be any quantity? So now
> >> say I have star particles which similarly have x,y,z but I want to
> >> distribute their luminosity. Again, I want to do it for say the gas
> >> velocity field as well. Is there any general functionality for
> converting
> >> particle quantities to mesh quantites in yt with the deposit all_cic
> >> functionality? I have a basic code for just x,y,z particle data and
> >> distributing that based on density to a cic (see below)
> >>
> >> ad = pf.all_data()
> >> level = int(math.log(ndim,2))
> >> cg = pf.covering_grid(level=level,
> >> left_edge=[0,0,0],dims=[ndim,ndim,ndim])
> >> arr = cg['deposit', 'all_cic'],
> >>
> >> but I'm not sure what to do for the other variables. Any help is
> >> appreciated in advance.
> >>
> >> Thanks.
> >> Brendan
> >>
> >> _______________________________________________
> >> yt-users mailing list
> >> yt-users(a)lists.spacepope.org
> >> <javascript:_e(%7B%7D,'cvml','yt-users(a)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/201…
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> yt-users mailing list
> yt-users(a)lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
> ------------------------------
>
> End of yt-users Digest, Vol 88, Issue 55
> ****************************************
>
Hi Britton,
Thanks for the help. I'm getting an error trying to use
halo.data_container.
14 hc.add_callback("sphere",factor=1.0)
15 def _gas_mass(halo):
---> 16 return
halo.data_container.quantities.total_quantity("cell_mass")
17
18 add_quantity("gas_mass",_gas_mass)
AttributeError: 'Halo' object has no attribute 'data_container'
I've made my code very simple and am using the example data to debug this.
I'm just trying to get the total gas mass for now
data_ds = yt.load('Enzo_64/RD0006/RedshiftOutput0006')
halos_ds = yt.load('rockstar_halos/halos_0.0.bin')
def _gas_mass(halo):
return halo.data_container.quantities.total_quantity("cell_mass")
add_quantity("gas_mass",_gas_mass)
# Instantiate a catalog using those two paramter files
hc = HaloCatalog(data_ds=data_ds, halos_ds=halos_ds)
hc.add_callback("sphere",factor=1.0)
hc.add_quantity("gas_mass")
hc.create()
Any help would be appreciated.
Thanks,
Ari
Hi,
I've been trying to make a movie from volume renderings with Yt. The
data is available as uniform numpy arrays, which are loaded using non-Yt
infrastructure. For each movie frame, the following is done:
Create Yt data from 3D numpy array rho
dct = {"density":rho}
ytdat = yt.load_uniform_grid(dct, sh, bbox=bbox)
Create camera
cam = ytdat.camera(c, L, W, N, self.transf, fields['density'],
north_vector=[0,0,1], steady_north=True,
sub_samples=5, log_fields=[True])
cam.transfer_function.map_to_colormap(self.lgmin,self.lgmax,
scale=15.0, colormap='algae')
Save movie frame as png:
cam.snapshot(fn=name)
Even with medium sized datasets (60^3), this runs out of memory after 30
frames or so. Some observations:
Doing the same thing, but without the cam.snapshot(fn=name), the memory
leak is gone.
Creating the camera just once from the first dataset, and use
cam.snapshot every frame does *not* increase memory usage. Of course, it
then renders the same data over and over.
Maybe I am doing something wrong. For example, is there a way to just
replace the dataset for an existing camera?
Any hints ?
Best Regards,
Wolfgang Kastaun.
Hi Everyone,
I'm trying to add a quantity to my halo catalog which is cold gas mass. We
can assume I've already defined the field cold_gas_mass, but I'm having
trouble understanding how to add it to my halo catalog. The examples all
seem to be for profiles and it isn't clear to me what to do if you aren't
looking for a profile. Does anyone have an example of doing something like
this they could share? The total gas mass or any other sum of fluid
quantities would probably be close enough for me understand the syntax.
Thanks,
Ari
Hi Britton,
When I set critical_density=500, does it mean 500 times of the average
density, or 500 times of the critical density?
Thanks,
Jingjing
2015-03-20 4:22 GMT-04:00 Britton Smith <brittonsmith(a)gmail.com>:
> Hi Reju,
>
> It looks like the version of the notebook you are working from is a little
> out of date as the syntax for some of those callbacks has changed. Please,
> have a look here for an updated version:
> http://yt-project.org/doc/cookbook/halo_analysis_example.html
> I just ran this myself and confirmed everything to be working.
>
> As for your other questions:
>
> 1) How to find the center of mass of the halos(
>> hc.add_quantity('center_of_mass') is not working )
>>
>
> By default, the halo catalog is storing the center of the halo as
> calculated by the halo finder that you used. If you reload the halo
> catalog that you produce, the x, y, and z position of each halo are the
> "particle_position_x", "particle_position_y", "particle_position_z"
> fields. For example, you could do:
> ds = yt.load(your_halo_catalog)
> ad = ds.all_data()
> print ad["particle_position_x"]
>
> Additionally, the halo catalog has a callback called
> "iterative_center_of_mass" which starts from the original center and
> iteratively recalculates the center of mass while reducing the radius of
> the sphere. I have found this to work very well for calculating halo
> centers. If you use this callback, it will rewrite the particle_position
> fields to contain the new center for each halo. To get more information on
> this callback, do the following:
>
> from yt.analysis_modules.halo_analysis.halo_callbacks import *
> help(iterative_center_of_mass)
>
>
>> 2) How to find virial mass (both M_500 and M_200 ) of the halas
>>
>
> You can find these using the virial_quantities callback. In the example
> you are working from, you can add another field to the virial_quantities
> callback you use and it would calculate the value of that field where the
> overdensity = 200. For total mass, the field you want is called
> "matter_mass". To get M_500 instead of M_200, you can call the
> virial_quantities callback again and give the keyword argument
> critical_density=500.
>
> Britton
>
> _______________________________________________
> yt-users mailing list
> yt-users(a)lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
--
Jingjing Chen [ chenjj235(a)gmail.com ]
Department of Astronomy
Columbia University
550 West 120th Street
New York, New York 10027
Cell Phone: +1(347)5746709