[yt-svn] commit/yt: MatthewTurk: Merged in ngoldbaum/yt/yt-3.0 (pull request #877)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon May 5 19:13:35 PDT 2014
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/928aef1f9c9e/
Changeset: 928aef1f9c9e
Branch: yt-3.0
User: MatthewTurk
Date: 2014-05-06 04:13:25
Summary: Merged in ngoldbaum/yt/yt-3.0 (pull request #877)
Tipsy/gasoline notebook
Affected #: 3 files
diff -r 907cb91838fe6a2ef52306d9a0c98dab2dc23c1f -r 928aef1f9c9ede0d3a6f7d2a14f020a81f186758 doc/source/examining/loading_data.rst
--- a/doc/source/examining/loading_data.rst
+++ b/doc/source/examining/loading_data.rst
@@ -390,6 +390,11 @@
These will be used set the units, if they are specified.
+Using yt to view and analyze Tipsy outputs from Gasoline
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+.. notebook:: tipsy_any_yt.ipynb
+
.. _loading-artio-data:
ARTIO Data
diff -r 907cb91838fe6a2ef52306d9a0c98dab2dc23c1f -r 928aef1f9c9ede0d3a6f7d2a14f020a81f186758 doc/source/examining/tipsy_and_yt.ipynb
--- /dev/null
+++ b/doc/source/examining/tipsy_and_yt.ipynb
@@ -0,0 +1,195 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:a80c1b224c121c67e57acfa9183c5660a332a37556a492e230476b424827885f"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Using yt to view and analyze Tipsy outputs from Gasoline"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Loading Files"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Alright, let's start with some basics. Before we do anything, we will need to load a snapshot. You can do this using the ```load``` convenience function. yt will autodetect that you have a tipsy snapshot, and automatically set itself up appropriately."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from yt.mods import *"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "We will be looking at a fairly low resolution dataset. In the next cell, the `ds` object has an atribute called `n_ref` that tells the oct-tree how many particles to refine on. The default is 64, but we'll get prettier plots (at the expense of a deeper tree) with 8. Just passing the argument `n_ref=8` to load does this for us."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ ">This dataset is available for download at http://yt-project.org/data/TipsyGalaxy.tar.gz (10 MB)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "ds = load('TipsyGalaxy/galaxy.00300', n_ref=8)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "We now have a `TipsyDataset` object called `ds`. Let's see what fields it has."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "ds.field_list"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "`yt` also defines so-called \"derived\" fields. These fields are functions of the on-disk fields that live in the `field_list`. There is a `derived_field_list` attribute attached to the `Dataset` object - let's take look at the derived fields in this dataset:"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "ds.derived_field_list"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "All of the field in the `field_list` are arrays containing the values for the associated particles. These haven't been smoothed or gridded in any way. We can grab the array-data for these particles using `ds.all_data()`. For example, let's take a look at a temperature-colored scatterplot of the gas particles in this output."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "%matplotlib inline\n",
+ "import matplotlib.pyplot as plt"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "dd = ds.all_data()\n",
+ "xcoord = dd['Gas','Coordinates'][:,0].v\n",
+ "ycoord = dd['Gas','Coordinates'][:,1].v\n",
+ "logT = np.log10(dd['Gas','Temperature'])\n",
+ "plt.scatter(xcoord, ycoord, c=logT, s=2*logT, marker='o', edgecolor='none', vmin=2, vmax=6)\n",
+ "plt.xlim(-20,20)\n",
+ "plt.ylim(-20,20)\n",
+ "cb = plt.colorbar()\n",
+ "cb.set_label('$\\log_{10}$ Temperature')\n",
+ "plt.gcf().set_size_inches(15,10)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Making Smoothed Images"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "`yt` will automatically generate smoothed versions of these fields that you can use to plot. Let's make a temperature slice and a density projection."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "SlicePlot(ds, 'z', ('gas','density'), width=(40, 'kpc'), center='m')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "ProjectionPlot(ds, 'z', ('gas','density'), width=(40, 'kpc'), center='m')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Not only are the values in the tipsy snapshot read and automatically smoothed, the auxiliary files that have physical significance are also smoothed. Let's look at a slice of Iron mass fraction."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "SlicePlot(ds, 'z', ('gas', 'FeMassFrac'), width=(40, 'kpc'), center='m')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list