Hello,
I would like to plot the HI column density as a function of the radius. To do this I follow these steps.
But instead of the column density (in cm-2) the y-axis is number density (in cm-3):
fn = '../IsolatedGalaxy/galaxy0030/galaxy0030'
ds = yt.load(fn)
trident.add_ion_fields(ds, ions = ['H I'], ftype = 'gas')
sphere = ds.sphere('c', (100., 'kpc'))
plot = yt.ProfilePlot(sphere, 'radius', 'H_p0_number_density', weight_field = None)
plot.save('my_fig.png')
The field 'H_p0_number_density' should return the column density because it does so
when I use the following line of code:
plot = yt.ProjectionPlot(ds, 'z', 'H_p0_number_density')
plot.save('fig.png')
Here the 'H_p0_number_density' is interpreted as column density but not as number density.
I would be very grateful if some one could help me with this issue.
Many thanks
Best regards,
Hassan
Good afternoon!
I am a PhD student at the University of Florida and am looking to use yt for a relatively specific function. In the past I have used it to create flat grids of data to export and give to other groups. These worked well due to their ability to flatten the adaptive mesh and interpolate between points to provide a nice, smooth mesh.
What I would like to do now is be able to iterate through the grids that are stored in the yt object in order to output the whole data array. I need to do this in order to get the full spectrum of data and output it into a different file format (.SILO). The group requesting this information is looking to avoid flattening the data and wants access to the different levels of information in the adaptive mesh.
I’ve come across several ways to access information about the individual grids of the stored data. Once I have loaded the file [often as an object called ds, ds = yt.load(file)], I can view information such as the grid names, the number of grids, and the size of grids through functions such as ds.index.grids, etc. Is there another function similar to index that allows the user to call data from an individual grid? For example, with index.grids[XXXX].size I can see that grid XXXX is [16 16 1]. I would like to be able to output that individual grid to an array. If it’s simpler maybe only export the data for say, ‘temperature’. I have found some calls to a similar process in the URL below:
https://yt-project.org/doc/quickstart/data_inspection.html
Thank you for your time. Please let me know if you are able to provide assistance in this matter.
Have a great day!
Anthony Egeln Jr.
University of Florida
anthony.egeln(a)ufl.edu<mailto:anthony.egeln@ufl.edu>
904 652 3159
Hello,
I have installed yt successfully and then I tried to install 'trident' using the following command
pip install trident
But when I issued import trident, I got the following error:
It seems that it is complaining that loader does not exist in yt.
>>> import trident
/usr/lib/python3.8/_collections_abc.py:666: MatplotlibDeprecationWarning: The global colormaps dictionary is no longer considered public API.
self[key]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pc/.local/lib/python3.8/site-packages/trident/__init__.py", line 63, in <module>
from trident.ray_generator import \
File "/home/pc/.local/lib/python3.8/site-packages/trident/ray_generator.py", line 14, in <module>
from trident.light_ray import \
File "/home/pc/.local/lib/python3.8/site-packages/trident/light_ray.py", line 19, in <module>
from yt_astro_analysis.cosmological_observation.cosmology_splice import \
File "/home/pc/yt_astro_analysis/yt_astro_analysis/cosmological_observation/cosmology_splice.py", line 19, in <module>
from yt.loaders import \
ModuleNotFoundError: No module named 'yt.loaders'
>>>
I would be grateful if some one could provide some help on this.
Best regards,
Hassan
Dear all,
I have installed yt and its associated rockstar but when I execute the following command:
from yt.analysis_modules.halo_finding.rockstar import rockstar_interface
I get the following error:
>>> from yt.analysis_modules.halo_finding.rockstar import rockstar_interface
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pc/yt-conda/src/yt-git/yt/__init__.py", line 21, in <module>
from yt.data_objects.api import (
File "/home/pc/yt-conda/src/yt-git/yt/data_objects/api.py", line 1, in <module>
from . import construction_data_containers as __cdc, selection_objects as __sdc
File "/home/pc/yt-conda/src/yt-git/yt/data_objects/construction_data_containers.py", line 15, in <module>
from yt.data_objects.selection_objects.data_selection_objects import (
File "/home/pc/yt-conda/src/yt-git/yt/data_objects/selection_objects/__init__.py", line 1, in <module>
from .boolean_operations import (
File "/home/pc/yt-conda/src/yt-git/yt/data_objects/selection_objects/boolean_operations.py", line 5, in <module>
from yt.data_objects.selection_objects.data_selection_objects import (
File "/home/pc/yt-conda/src/yt-git/yt/data_objects/selection_objects/data_selection_objects.py", line 11, in <module>
from yt.data_objects.data_containers import YTDataContainer
File "/home/pc/yt-conda/src/yt-git/yt/data_objects/data_containers.py", line 8, in <module>
from yt.data_objects.profiles import create_profile
File "/home/pc/yt-conda/src/yt-git/yt/data_objects/profiles.py", line 14, in <module>
from yt.utilities.lib.misc_utilities import (
File "yt/utilities/lib/misc_utilities.pyx", line 1, in init yt.utilities.lib.misc_utilities
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
>>>
I would be grateful if some one could help me with this issue.
With best regards,
Hassan
Hi yters!
I have been working of a relaunch of the yt blog with Matt over the past
few weeks (it was previewed at the RHytHM workshop if you want to watch the
talk about it (linked below)! Check it out at https://blog.yt-project.org/
Some of the things we tried to do when relaunching the blog was:
- find a format that allowed for easy filtering of posts (in this blog we
have tags, categories, and a search feature)
- Find a format that has a nice post preview (with images)
- Choose something that is accessible to various levels of contribution.
We would love your feedback and contributions on the new blog! What can
make it *even better*? What topics would you like to see on the blog? What
could *you* add to the blog???? I personally think it would be cool to see
stuff like:
- How you use yt for YOUR SCIENCE
- What cool tips and tricks do you use in yt?
- Do you have a favorite feature? What is it and why?
- Did you write a cool extension that uses yt? Let's hear about it!
- Do you have a very cool colormap theme that you use with yt based on
album covers of an artist??? What does science data look like with them???
- And so much more!
We have two different ways of contributing a blog post: either as an issue
or as a PR. You can check out the differences in the contributor guide.
We've moved the blog repo into the yt project organization, it is now
located at https://github.com/yt-project/blog
You can find the blog hosted at https://blog.yt-project.org/
I can't wait to see all of your posts!!!
Madicken
PS -- Chris Havlin has already contributed two new posts to the blog! Dask!
Napari! So many cool things! Check them out.
Hi yt-users!
It's been a while since we've had scheduled triage meetings during the
week. We use triage meetings to do development and maintenance work on the
project. If you'd like to help contribute to making yt *better* and maybe
even more useful for you, consider attending! All skill levels in
development are welcome and encouraged to attend. If you're a bit shy,
don't worry, you can also attend and just listen!
I've created two polls. The first is morning in central US timezone to
hopefully catch times where project members located in Europe can join, and
the second is for afternoon/early evening in the central US timezone so
project members on the west coast and asia can hopefully join. Vote in
whatever poll applies to you (or both if you find all times work). We will
choose times to accommodate the most people, and I personally would love to
see all of you attend!!!
I've put times for next week, but know that these polls are your *general
availability *weekly for the next few months.
Morning Poll:
http://whenisgood.net/tmdfp2i
Afternoon Poll:
http://whenisgood.net/i2c8n3b
- Madicken
Hello!
I want to create 3D field within a spherical object. For example, I create 3D electron density in the following manner:
ds = yt.load("DATA")
dd = ds.all_data()
max_level = ds.index.max_level
ref = 2**max_level
low = ds.domain_left_edge
dims = ds.domain_dimensions*ref
nx, ny, nz = dims
L = (ds.domain_right_edge - ds.domain_left_edge).d
all_data_level_max = ds.covering_grid(level=max_level,left_edge=low,dims=dims)
def _elec_den(field,data):
N_A = 1/1.6726219e-24
X = 0.70
return ((all_data_level_max['gas','density'])*N_A*(1+X)/2/ds.quan(1,'g') )
ds.add_field(('gas','elec_den'), function=_elec_den, units='auto', dimensions=dimensions.number_density)
Then if I do:
dd['elec_den']
it will give me a 3D field which will have the same dimensions as the root grid of the dataset. However, if I create spheres and then a spherical object between these two spheres:
rvir = 4.2454307068129566e+24 #virial radius of a halo [cm].
xyz = [0.4208984375, 0.2216796875, 0.5185546875] #centre of a halo.
sph1 = ds.sphere(xyz, (2*rvir, 'cm'))
sph2 = ds.sphere(xyz, (4*rvir, 'cm'))
cutout_obj = sph2 - sph1
cutout_obj['elec_den'] or sph1['elec_den'] and sph2['elec_den'] will have the same dimensions as dd['elec_den'] ; but this cannot be true since sph1 and sph2 include less grid points.
Is there a way I can create 3D field and use it within a different yt objects?
Thanks,
Salome
Hi yt-Users,
I have an issue with the stereo-spherical lens in volume rendering. I am simulating galaxy collusions with the Enzo Code and now I want to try to visualize these collusions in VR with the help of the stereo-spherical lens. My problem right now is that my box I am simulating the galaxies in, is much bigger than the galaxies itself. So, the galaxies are very small in the end and the plot is quite inexpressive. My approach to solve this problem was to reduce the volume, by putting a sphere around my galaxies like:
data=yt.load(…)
ds= data.h.sphere(‘max’, (100, ‘kpc’)
(Please feel free to check the whole code on: https://cloud.hs.uni-hamburg.de/s/NZMiAWkSX9Zztse)
But in the end this doesn´t changed the look of plot at all. The galaxies were as small as before.
Do you have an idea how to solve this problem and getting a better view on the merging galaxies?
Many thanks,
David Smolinski
Dear all,
TLDR; We recently migrated yt's configuration system from the yt-3
format to a new and more flexible format in yt-4 (the toml format, see
https://github.com/yt-project/yt/pull/2981). *This requires a manual
intervention to perform the migration (see details below).*
------------------------------------------------------------------------
*What does it change for users?*
The new configuration system is documented online here:
https://yt-project.org/docs/dev/reference/configuration.html.
*Performing the migration*
The change requires a one-time manual intervention on your side to
perform the migration automatically. To perform the migration, simply
type in your console
yt config migrate
This should migrate your old configuration to the new format (stored in
~/.config/yt/yt.toml) and store a backup of your old configuration file
in ~/.config/yt/ytrc.bak should any error happen. Please report any
issue you may encounter in the migration procedure so that we can fix
them before releasing officially yt-4.
If you get an error about a missing toml package, you may also have to
install the toml package manually|
|
| conda install -c conda-forge toml # if you are using conda
pip install toml # otherwise
|
Per-folder configuration
The new configuration system allows you to configure yt per-folder. In
particular, if a file named yt.toml is present in your current working
folder, this file will override the global configuration. You can easily
configure yt from the command line using
yt config set yt log_level 40 --global # this will write in
~/.config/yt/yt.toml
# or
yt config set yt log_level 40 --local # this will write in ./yt.toml
Naming convention
We have also rationalized the naming convention of configurable keys in
the configuration file: all keys now use snake case (i.e. words
separated by an underscore). For example loglevel has become log_level.
This is handled automatically by the configuration script, but bear that
in mind if you modify the configuration file. For reference, all
configurable keys can currently be found online
https://github.com/yt-project/yt/blob/main/yt/config.py#L12 and the most
important ones are documented online
(https://yt-project.org/docs/dev/reference/configuration.html).
What does it change for developers?
The new format should allow more flexible configuration options. In
particular, it supports nested configuration blocks and allows to find
the most specific key in the configuration file
# yt.toml
[fields]
cmap = "arbre"
[fields.gas]
cmap = "viridis"
[fields.gas.temperature]
cmap = "plasma"
In Python, you can then query the "most specific" key matching a given path:
from yt.config import ytcfg
ytcfg.get_most_specific("fields", "gas", "temperature", "cmap") == "plasma"
ytcfg.get_most_specific("fields", "gas", "density", "cmap") == "viridis"
ytcfg.get_most_specific("fields", "io", "velocity_x", "cmap") == "arbre"
This isn't used anywhere /yet/. The other breaking change compared to
the old configuration system is that ytcfg.get returns typed quantities
(as read by the toml parser) instead of strings.
Best,
Corentin
--
Dr. Corentin Cadiou
Post Doctoral Research Assistant
Cosmoparticle Initiative Hub, desk 27
University College London (UCL)
Gower St, Bloomsbury, London WC1E 6BT
mobile: +33.6.43.18.66.83