[yt-svn] commit/yt: 9 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Dec 9 11:08:50 PST 2014


9 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/ef2314ae11be/
Changeset:   ef2314ae11be
Branch:      yt
User:        chummels
Date:        2014-12-03 19:24:11+00:00
Summary:     Updating RadMC3D interface to work with yt 3.0
Affected #:  1 file

diff -r 02ef23fcc82e96c58e4786027e42534cc6d09be1 -r ef2314ae11be5dcfcf42ce65f07e7e7218b457cf yt/analysis_modules/radmc3d_export/RadMC3DInterface.py
--- a/yt/analysis_modules/radmc3d_export/RadMC3DInterface.py
+++ b/yt/analysis_modules/radmc3d_export/RadMC3DInterface.py
@@ -13,7 +13,8 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-from yt.mods import *
+import yt
+import numpy as np
 from yt.utilities.lib.write_array import \
     write_3D_array, write_3D_vector_array
 
@@ -86,40 +87,42 @@
     file "dust_density.inp" in a form readable by radmc3d. It will also write
     a "dust_temperature.inp" file with everything set to 10.0 K: 
 
-    >>> from yt.mods import *
-    >>> from yt.analysis_modules.radmc3d_export.api import *
+    >>> import yt
+    >>> from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
     >>> dust_to_gas = 0.01
     >>> def _DustDensity(field, data):
     ...     return dust_to_gas*data["Density"]
-    >>> add_field("DustDensity", function=_DustDensity)
+    >>> yt.add_field("DustDensity", function=_DustDensity)
 
     >>> def _DustTemperature(field, data):
     ...     return 10.0*data["Ones"]
-    >>> add_field("DustTemperature", function=_DustTemperature)
+    >>> yt.add_field("DustTemperature", function=_DustTemperature)
     
-    >>> ds = load("galaxy0030/galaxy0030")
+    >>> ds = yt.load("galaxy0030/galaxy0030")
     >>> writer = RadMC3DWriter(ds)
     
     >>> writer.write_amr_grid()
     >>> writer.write_dust_file("DustDensity", "dust_density.inp")
     >>> writer.write_dust_file("DustTemperature", "dust_temperature.inp")
 
-    This will create a field called "NumberDensityCO" and write it out to
+    ---
+
+    This example will create a field called "NumberDensityCO" and write it out to
     the file "numberdens_co.inp". It will also write out information about
     the gas velocity to "gas_velocity.inp" so that this broadening may be
     included in the radiative transfer calculation by radmc3d:
 
-    >>> from yt.mods import *
-    >>> from yt.analysis_modules.radmc3d_export.api import *
+    >>> import yt
+    >>> from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
     >>> x_co = 1.0e-4
     >>> mu_h = 2.34e-24
     >>> def _NumberDensityCO(field, data):
     ...     return (x_co/mu_h)*data["Density"]
-    >>> add_field("NumberDensityCO", function=_NumberDensityCO)
+    >>> yt.add_field("NumberDensityCO", function=_NumberDensityCO)
     
-    >>> ds = load("galaxy0030/galaxy0030")
+    >>> ds = yt.load("galaxy0030/galaxy0030")
     >>> writer = RadMC3DWriter(ds)
     
     >>> writer.write_amr_grid()
@@ -183,8 +186,8 @@
         RE   = self.domain_right_edge
 
         # Radmc3D wants the cell wall positions in cgs. Convert here:
-        LE_cgs = LE * self.ds.units['cm']
-        RE_cgs = RE * self.ds.units['cm']
+        LE_cgs = LE.in_units('cm')
+        RE_cgs = RE.in_units('cm')
 
         # calculate cell wall positions
         xs = [str(x) for x in np.linspace(LE_cgs[0], RE_cgs[0], dims[0]+1)]


https://bitbucket.org/yt_analysis/yt/commits/aa86a2158855/
Changeset:   aa86a2158855
Branch:      yt
User:        chummels
Date:        2014-12-03 19:32:25+00:00
Summary:     Adding test for RadMC3D exporter.
Affected #:  1 file

diff -r ef2314ae11be5dcfcf42ce65f07e7e7218b457cf -r aa86a21588556cb760d78ebd202cfe9d543ec449 yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
--- /dev/null
+++ b/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
@@ -0,0 +1,41 @@
+"""
+Unit test for the RADMC3D Exporter analysis module
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2014, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+import yt
+from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
+from yt.units.yt_array import YTQuantity
+from yt.testing import *
+
+def test_radmc3d_exporter():
+    """
+    This test is simply following the description in the docs for how to
+    generate the necessary output files to run a continuum emission map from
+    dust for one of our sample datasets.
+    """
+
+    # Make up a dust density field where dust density is 1% of gas density
+    dust_to_gas = 0.01
+    def _DustDensity(field, data):
+        return dust_to_gas * data["density"]
+    yt.add_field(("gas", "dust_density"), function=_DustDensity, units="g/cm**3")
+    
+    # Make up a dust temperature field where temp = 10K everywhere
+    def _DustTemperature(field, data):
+        return 0.*data["temperature"] + data.ds.quan(10,'K')
+    yt.add_field(("gas", "dust_temperature"), function=_DustTemperature, units="K")
+    
+    ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+    writer = RadMC3DWriter(ds)
+    
+    writer.write_amr_grid()
+    writer.write_dust_file(("gas", "dust_density"), "dust_density.inp")
+    writer.write_dust_file(("gas", "dust_temperature"), "dust_temperature.inp")


https://bitbucket.org/yt_analysis/yt/commits/0a4ca5e70ddb/
Changeset:   0a4ca5e70ddb
Branch:      yt
User:        chummels
Date:        2014-12-03 20:10:11+00:00
Summary:     Cleaning up test.
Affected #:  1 file

diff -r aa86a21588556cb760d78ebd202cfe9d543ec449 -r 0a4ca5e70ddb3fd71d466b80da4f53b728cc303c yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
--- a/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
+++ b/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
@@ -12,10 +12,8 @@
 
 import yt
 from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
-from yt.units.yt_array import YTQuantity
-from yt.testing import *
 
-def test_radmc3d_exporter():
+def test_radmc3d_exporter_continuum():
     """
     This test is simply following the description in the docs for how to
     generate the necessary output files to run a continuum emission map from


https://bitbucket.org/yt_analysis/yt/commits/c84d1bf70bb6/
Changeset:   c84d1bf70bb6
Branch:      yt
User:        chummels
Date:        2014-12-03 20:10:32+00:00
Summary:     Updating docs to reflect a working RadMC3D exporter.
Affected #:  1 file

diff -r 0a4ca5e70ddb3fd71d466b80da4f53b728cc303c -r c84d1bf70bb6d2a6a2e62ea84acb082e9d3b887d doc/source/analyzing/analysis_modules/radmc3d_export.rst
--- a/doc/source/analyzing/analysis_modules/radmc3d_export.rst
+++ b/doc/source/analyzing/analysis_modules/radmc3d_export.rst
@@ -6,17 +6,11 @@
 .. sectionauthor:: Andrew Myers <atmyers2 at gmail.com>
 .. versionadded:: 2.6
 
-.. note:: 
-
-    As of :code:`yt-3.0`, the radial column density analysis module is not
-    currently functional.  This functionality is still available in
-    :code:`yt-2.x`.  If you would like to use these features in :code:`yt-3.x`,
-    help is needed to port them over.  Contact the yt-users mailing list if you
-    are interested in doing this.
-
 `RADMC-3D
-<http://www.ita.uni-heidelberg.de/~dullemond/software/radmc-3d/>`_ is a three-dimensional Monte-Carlo radiative transfer code
-that is capable of handling both line and continuum emission. The :class:`~yt.analysis_modules.radmc3d_export.RadMC3DInterface.RadMC3DWriter`
+<http://www.ita.uni-heidelberg.de/~dullemond/software/radmc-3d/>`_ is a 
+three-dimensional Monte-Carlo radiative transfer code that is capable of 
+handling both line and continuum emission. The 
+:class:`~yt.analysis_modules.radmc3d_export.RadMC3DInterface.RadMC3DWriter`
 class saves AMR data to disk in an ACSII format that RADMC-3D can read. 
 In principle, this allows one to use RADMC-3D to make synthetic observations 
 from any simulation data format that yt recognizes.
@@ -31,74 +25,77 @@
 
 .. code-block:: python
 
-    from yt.mods import *
-    from yt.analysis_modules.radmc3d_export.api import *
+    import yt
+    from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
-Then, define a field that calculates the dust density in each cell. Here, we assume
-a constant dust-to-gas mass ratio of 0.01:
+Then, define a field that calculates the dust density in each cell. Here, we 
+assume a constant dust-to-gas mass ratio of 0.01:
 
 .. code-block:: python
 
     dust_to_gas = 0.01
     def _DustDensity(field, data):
-        return dust_to_gas*data["density"]
-    add_field("DustDensity", function=_DustDensity)
+        return dust_to_gas * data["density"]
+    yt.add_field(("gas", "dust_density"), function=_DustDensity, units="g/cm**3")
 
 Now load up a dataset and call the
 :class:`~yt.analysis_modules.radmc3d_export.RadMC3DInterface.RadMC3DWriter`:
 
 .. code-block:: python
 
-    ds = load("galaxy0030/galaxy0030")
+    ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
     writer = RadMC3DWriter(ds)
     
     writer.write_amr_grid()
-    writer.write_dust_file("DustDensity", "dust_density.inp")
+    writer.write_dust_file(("gas", "dust_density"), "dust_density.inp")
 
-The method write_amr_grid() creates an "amr_grid.inp" file that tells RADMC-3D how
-to interpret the rest of the data, while "dust_density.inp" contains the actual data field. 
+The method write_amr_grid() creates an "amr_grid.inp" file that tells RADMC-3D 
+how to interpret the rest of the data, while "dust_density.inp" contains the 
+actual data field. 
 
-We can also supply temperature information. The following code creates a "DustTemperature"
-field that is constant at 10 K, and saves it into a file called "dust_temperature.inp"
+We can also supply temperature information. The following code creates a 
+"dust_temperature" field that is constant at 10 K, and saves it into a file 
+called "dust_temperature.inp"
 
 .. code-block:: python
 
     def _DustTemperature(field, data):
-        return 10.0*data["Ones"]
-    add_field("DustTemperature", function=_DustTemperature)
+        return 0. * data["temperature"] + data.ds.quan(10, 'K')
+    yt.add_field(("gas", "dust_temperature"), function=_DustTemperature, units="K")
     
-    writer.write_dust_file("DustTemperature", "dust_temperature.inp")
+    writer.write_dust_file(("gas", "dust_temperature"), "dust_temperature.inp")
 
-With the "amr_grid.inp", "dust_density.inp", and "dust_temperature.inp" files, RADMC-3D
-has everything it needs to compute the thermal dust emission (you may also have to include
-the location and spectra of any sources, which currently must be done manually). 
-The result is something that looks like this:
+With the "amr_grid.inp", "dust_density.inp", and "dust_temperature.inp" files, 
+RADMC-3D has everything it needs to compute the thermal dust emission (you may 
+also have to include the location and spectra of any sources, which currently 
+must be done manually).  The result is something that looks like this:
 
 .. image:: _images/31micron.png
 
 Line Emission
 -------------
 
-The file format required for line emission is slightly different. The following script will generate 
-two files, one called "numderdens_co.inp", which contains the number density of CO molecules
-for every cell in the index, and another called "gas-velocity.inp", which is useful if you want 
-to include doppler broadening.
+The file format required for line emission is slightly different. The 
+following script will generate two files, one called "numderdens_co.inp", 
+which contains the number density of CO molecules for every cell in the index, 
+and another called "gas-velocity.inp", which is useful if you want to include 
+doppler broadening.
 
 .. code-block:: python
 
-    from yt.mods import *
-    from yt.analysis_modules.radmc3d_export.api import *
+    import yt
+    from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
     x_co = 1.0e-4
     mu_h = 2.34e-24
     def _NumberDensityCO(field, data):
         return (x_co/mu_h)*data["density"]
-    add_field("NumberDensityCO", function=_NumberDensityCO)
+    yt.add_field(("gas", "number_density_CO"), function=_NumberDensityCO, units="cm**-3")
     
-    ds = load("galaxy0030/galaxy0030")
+    ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
     writer = RadMC3DWriter(ds)
     
     writer.write_amr_grid()
-    writer.write_line_file("NumberDensityCO", "numberdens_co.inp")
+    writer.write_line_file(("gas", "number_density_CO"), "numberdens_co.inp")
     velocity_fields = ["velocity_x", "velocity_y", "velocity_z"]
     writer.write_line_file(velocity_fields, "gas_velocity.inp") 


https://bitbucket.org/yt_analysis/yt/commits/f49fce43b2ff/
Changeset:   f49fce43b2ff
Branch:      yt
User:        chummels
Date:        2014-12-03 20:11:41+00:00
Summary:     Merging.
Affected #:  3 files

diff -r 9d96ac2cfc308468239e99e88552a704168291e0 -r f49fce43b2fff4ec250e109a9f17bfac2788c17f doc/source/analyzing/analysis_modules/radmc3d_export.rst
--- a/doc/source/analyzing/analysis_modules/radmc3d_export.rst
+++ b/doc/source/analyzing/analysis_modules/radmc3d_export.rst
@@ -6,17 +6,11 @@
 .. sectionauthor:: Andrew Myers <atmyers2 at gmail.com>
 .. versionadded:: 2.6
 
-.. note:: 
-
-    As of :code:`yt-3.0`, the radial column density analysis module is not
-    currently functional.  This functionality is still available in
-    :code:`yt-2.x`.  If you would like to use these features in :code:`yt-3.x`,
-    help is needed to port them over.  Contact the yt-users mailing list if you
-    are interested in doing this.
-
 `RADMC-3D
-<http://www.ita.uni-heidelberg.de/~dullemond/software/radmc-3d/>`_ is a three-dimensional Monte-Carlo radiative transfer code
-that is capable of handling both line and continuum emission. The :class:`~yt.analysis_modules.radmc3d_export.RadMC3DInterface.RadMC3DWriter`
+<http://www.ita.uni-heidelberg.de/~dullemond/software/radmc-3d/>`_ is a 
+three-dimensional Monte-Carlo radiative transfer code that is capable of 
+handling both line and continuum emission. The 
+:class:`~yt.analysis_modules.radmc3d_export.RadMC3DInterface.RadMC3DWriter`
 class saves AMR data to disk in an ACSII format that RADMC-3D can read. 
 In principle, this allows one to use RADMC-3D to make synthetic observations 
 from any simulation data format that yt recognizes.
@@ -31,74 +25,77 @@
 
 .. code-block:: python
 
-    from yt.mods import *
-    from yt.analysis_modules.radmc3d_export.api import *
+    import yt
+    from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
-Then, define a field that calculates the dust density in each cell. Here, we assume
-a constant dust-to-gas mass ratio of 0.01:
+Then, define a field that calculates the dust density in each cell. Here, we 
+assume a constant dust-to-gas mass ratio of 0.01:
 
 .. code-block:: python
 
     dust_to_gas = 0.01
     def _DustDensity(field, data):
-        return dust_to_gas*data["density"]
-    add_field("DustDensity", function=_DustDensity)
+        return dust_to_gas * data["density"]
+    yt.add_field(("gas", "dust_density"), function=_DustDensity, units="g/cm**3")
 
 Now load up a dataset and call the
 :class:`~yt.analysis_modules.radmc3d_export.RadMC3DInterface.RadMC3DWriter`:
 
 .. code-block:: python
 
-    ds = load("galaxy0030/galaxy0030")
+    ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
     writer = RadMC3DWriter(ds)
     
     writer.write_amr_grid()
-    writer.write_dust_file("DustDensity", "dust_density.inp")
+    writer.write_dust_file(("gas", "dust_density"), "dust_density.inp")
 
-The method write_amr_grid() creates an "amr_grid.inp" file that tells RADMC-3D how
-to interpret the rest of the data, while "dust_density.inp" contains the actual data field. 
+The method write_amr_grid() creates an "amr_grid.inp" file that tells RADMC-3D 
+how to interpret the rest of the data, while "dust_density.inp" contains the 
+actual data field. 
 
-We can also supply temperature information. The following code creates a "DustTemperature"
-field that is constant at 10 K, and saves it into a file called "dust_temperature.inp"
+We can also supply temperature information. The following code creates a 
+"dust_temperature" field that is constant at 10 K, and saves it into a file 
+called "dust_temperature.inp"
 
 .. code-block:: python
 
     def _DustTemperature(field, data):
-        return 10.0*data["Ones"]
-    add_field("DustTemperature", function=_DustTemperature)
+        return 0. * data["temperature"] + data.ds.quan(10, 'K')
+    yt.add_field(("gas", "dust_temperature"), function=_DustTemperature, units="K")
     
-    writer.write_dust_file("DustTemperature", "dust_temperature.inp")
+    writer.write_dust_file(("gas", "dust_temperature"), "dust_temperature.inp")
 
-With the "amr_grid.inp", "dust_density.inp", and "dust_temperature.inp" files, RADMC-3D
-has everything it needs to compute the thermal dust emission (you may also have to include
-the location and spectra of any sources, which currently must be done manually). 
-The result is something that looks like this:
+With the "amr_grid.inp", "dust_density.inp", and "dust_temperature.inp" files, 
+RADMC-3D has everything it needs to compute the thermal dust emission (you may 
+also have to include the location and spectra of any sources, which currently 
+must be done manually).  The result is something that looks like this:
 
 .. image:: _images/31micron.png
 
 Line Emission
 -------------
 
-The file format required for line emission is slightly different. The following script will generate 
-two files, one called "numderdens_co.inp", which contains the number density of CO molecules
-for every cell in the index, and another called "gas-velocity.inp", which is useful if you want 
-to include doppler broadening.
+The file format required for line emission is slightly different. The 
+following script will generate two files, one called "numderdens_co.inp", 
+which contains the number density of CO molecules for every cell in the index, 
+and another called "gas-velocity.inp", which is useful if you want to include 
+doppler broadening.
 
 .. code-block:: python
 
-    from yt.mods import *
-    from yt.analysis_modules.radmc3d_export.api import *
+    import yt
+    from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
     x_co = 1.0e-4
     mu_h = 2.34e-24
     def _NumberDensityCO(field, data):
         return (x_co/mu_h)*data["density"]
-    add_field("NumberDensityCO", function=_NumberDensityCO)
+    yt.add_field(("gas", "number_density_CO"), function=_NumberDensityCO, units="cm**-3")
     
-    ds = load("galaxy0030/galaxy0030")
+    ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
     writer = RadMC3DWriter(ds)
     
     writer.write_amr_grid()
-    writer.write_line_file("NumberDensityCO", "numberdens_co.inp")
+    writer.write_line_file(("gas", "number_density_CO"), "numberdens_co.inp")
     velocity_fields = ["velocity_x", "velocity_y", "velocity_z"]
     writer.write_line_file(velocity_fields, "gas_velocity.inp") 

diff -r 9d96ac2cfc308468239e99e88552a704168291e0 -r f49fce43b2fff4ec250e109a9f17bfac2788c17f yt/analysis_modules/radmc3d_export/RadMC3DInterface.py
--- a/yt/analysis_modules/radmc3d_export/RadMC3DInterface.py
+++ b/yt/analysis_modules/radmc3d_export/RadMC3DInterface.py
@@ -13,7 +13,8 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-from yt.mods import *
+import yt
+import numpy as np
 from yt.utilities.lib.write_array import \
     write_3D_array, write_3D_vector_array
 
@@ -86,40 +87,42 @@
     file "dust_density.inp" in a form readable by radmc3d. It will also write
     a "dust_temperature.inp" file with everything set to 10.0 K: 
 
-    >>> from yt.mods import *
-    >>> from yt.analysis_modules.radmc3d_export.api import *
+    >>> import yt
+    >>> from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
     >>> dust_to_gas = 0.01
     >>> def _DustDensity(field, data):
     ...     return dust_to_gas*data["Density"]
-    >>> add_field("DustDensity", function=_DustDensity)
+    >>> yt.add_field("DustDensity", function=_DustDensity)
 
     >>> def _DustTemperature(field, data):
     ...     return 10.0*data["Ones"]
-    >>> add_field("DustTemperature", function=_DustTemperature)
+    >>> yt.add_field("DustTemperature", function=_DustTemperature)
     
-    >>> ds = load("galaxy0030/galaxy0030")
+    >>> ds = yt.load("galaxy0030/galaxy0030")
     >>> writer = RadMC3DWriter(ds)
     
     >>> writer.write_amr_grid()
     >>> writer.write_dust_file("DustDensity", "dust_density.inp")
     >>> writer.write_dust_file("DustTemperature", "dust_temperature.inp")
 
-    This will create a field called "NumberDensityCO" and write it out to
+    ---
+
+    This example will create a field called "NumberDensityCO" and write it out to
     the file "numberdens_co.inp". It will also write out information about
     the gas velocity to "gas_velocity.inp" so that this broadening may be
     included in the radiative transfer calculation by radmc3d:
 
-    >>> from yt.mods import *
-    >>> from yt.analysis_modules.radmc3d_export.api import *
+    >>> import yt
+    >>> from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
     >>> x_co = 1.0e-4
     >>> mu_h = 2.34e-24
     >>> def _NumberDensityCO(field, data):
     ...     return (x_co/mu_h)*data["Density"]
-    >>> add_field("NumberDensityCO", function=_NumberDensityCO)
+    >>> yt.add_field("NumberDensityCO", function=_NumberDensityCO)
     
-    >>> ds = load("galaxy0030/galaxy0030")
+    >>> ds = yt.load("galaxy0030/galaxy0030")
     >>> writer = RadMC3DWriter(ds)
     
     >>> writer.write_amr_grid()
@@ -183,8 +186,8 @@
         RE   = self.domain_right_edge
 
         # Radmc3D wants the cell wall positions in cgs. Convert here:
-        LE_cgs = LE * self.ds.units['cm']
-        RE_cgs = RE * self.ds.units['cm']
+        LE_cgs = LE.in_units('cm')
+        RE_cgs = RE.in_units('cm')
 
         # calculate cell wall positions
         xs = [str(x) for x in np.linspace(LE_cgs[0], RE_cgs[0], dims[0]+1)]

diff -r 9d96ac2cfc308468239e99e88552a704168291e0 -r f49fce43b2fff4ec250e109a9f17bfac2788c17f yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
--- /dev/null
+++ b/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
@@ -0,0 +1,39 @@
+"""
+Unit test for the RADMC3D Exporter analysis module
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2014, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+import yt
+from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
+
+def test_radmc3d_exporter_continuum():
+    """
+    This test is simply following the description in the docs for how to
+    generate the necessary output files to run a continuum emission map from
+    dust for one of our sample datasets.
+    """
+
+    # Make up a dust density field where dust density is 1% of gas density
+    dust_to_gas = 0.01
+    def _DustDensity(field, data):
+        return dust_to_gas * data["density"]
+    yt.add_field(("gas", "dust_density"), function=_DustDensity, units="g/cm**3")
+    
+    # Make up a dust temperature field where temp = 10K everywhere
+    def _DustTemperature(field, data):
+        return 0.*data["temperature"] + data.ds.quan(10,'K')
+    yt.add_field(("gas", "dust_temperature"), function=_DustTemperature, units="K")
+    
+    ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+    writer = RadMC3DWriter(ds)
+    
+    writer.write_amr_grid()
+    writer.write_dust_file(("gas", "dust_density"), "dust_density.inp")
+    writer.write_dust_file(("gas", "dust_temperature"), "dust_temperature.inp")


https://bitbucket.org/yt_analysis/yt/commits/97338e437031/
Changeset:   97338e437031
Branch:      yt
User:        chummels
Date:        2014-12-03 22:56:41+00:00
Summary:     Fixing the radmc3d test.
Affected #:  1 file

diff -r f49fce43b2fff4ec250e109a9f17bfac2788c17f -r 97338e43703117d763eb2c65353c6c07f79d15cf yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
--- a/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
+++ b/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
@@ -24,14 +24,14 @@
     dust_to_gas = 0.01
     def _DustDensity(field, data):
         return dust_to_gas * data["density"]
-    yt.add_field(("gas", "dust_density"), function=_DustDensity, units="g/cm**3")
     
     # Make up a dust temperature field where temp = 10K everywhere
     def _DustTemperature(field, data):
         return 0.*data["temperature"] + data.ds.quan(10,'K')
-    yt.add_field(("gas", "dust_temperature"), function=_DustTemperature, units="K")
     
     ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+    ds.add_field(("gas", "dust_density"), function=_DustDensity, units="g/cm**3")
+    ds.add_field(("gas", "dust_temperature"), function=_DustTemperature, units="K")
     writer = RadMC3DWriter(ds)
     
     writer.write_amr_grid()


https://bitbucket.org/yt_analysis/yt/commits/c42f71a4508e/
Changeset:   c42f71a4508e
Branch:      yt
User:        chummels
Date:        2014-12-04 02:11:14+00:00
Summary:     Making radmc3d test do its business in a temporary dir and purge afterwards.
Affected #:  1 file

diff -r 97338e43703117d763eb2c65353c6c07f79d15cf -r c42f71a4508e8f2a44bc0af91478421c2eff982c yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
--- a/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
+++ b/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
@@ -12,6 +12,10 @@
 
 import yt
 from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
+import tempfile
+import os
+import shutil
+
 
 def test_radmc3d_exporter_continuum():
     """
@@ -20,6 +24,11 @@
     dust for one of our sample datasets.
     """
 
+    # Set up in a temp dir
+    tmpdir = tempfile.mkdtemp()
+    curdir = os.getcwd()
+    os.chdir(tmpdir)
+
     # Make up a dust density field where dust density is 1% of gas density
     dust_to_gas = 0.01
     def _DustDensity(field, data):
@@ -37,3 +46,7 @@
     writer.write_amr_grid()
     writer.write_dust_file(("gas", "dust_density"), "dust_density.inp")
     writer.write_dust_file(("gas", "dust_temperature"), "dust_temperature.inp")
+
+    # clean up
+    os.chdir(curdir)
+    shutil.rmtree(tmpdir)


https://bitbucket.org/yt_analysis/yt/commits/81c74d7a7270/
Changeset:   81c74d7a7270
Branch:      yt
User:        chummels
Date:        2014-12-08 22:27:37+00:00
Summary:     Making sure radmc3d exporter test has the necessary dataset to run the nosetest.
Affected #:  1 file

diff -r c42f71a4508e8f2a44bc0af91478421c2eff982c -r 81c74d7a7270e90fa3926191a031c127f3052162 yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
--- a/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
+++ b/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
@@ -11,12 +11,16 @@
 #-----------------------------------------------------------------------------
 
 import yt
+from yt.testing import *
 from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
+from yt.config import ytcfg
 import tempfile
 import os
 import shutil
 
+ISO_GAL = "IsolatedGalaxy/galaxy0030/galaxy0030"
 
+ at requires_file(ISO_GAL)
 def test_radmc3d_exporter_continuum():
     """
     This test is simply following the description in the docs for how to
@@ -38,7 +42,7 @@
     def _DustTemperature(field, data):
         return 0.*data["temperature"] + data.ds.quan(10,'K')
     
-    ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+    ds = yt.load(ISO_GAL)
     ds.add_field(("gas", "dust_density"), function=_DustDensity, units="g/cm**3")
     ds.add_field(("gas", "dust_temperature"), function=_DustTemperature, units="K")
     writer = RadMC3DWriter(ds)


https://bitbucket.org/yt_analysis/yt/commits/9799455919d2/
Changeset:   9799455919d2
Branch:      yt
User:        ngoldbaum
Date:        2014-12-09 19:08:40+00:00
Summary:     Merged in chummels/yt (pull request #1332)

Updating RadMC3D exporter analysis module
Affected #:  3 files

diff -r c49dbb18e2f0cbc1357be61e77a1757bf4aa47d2 -r 9799455919d22c5c6d6168287bb69439a9fd1962 doc/source/analyzing/analysis_modules/radmc3d_export.rst
--- a/doc/source/analyzing/analysis_modules/radmc3d_export.rst
+++ b/doc/source/analyzing/analysis_modules/radmc3d_export.rst
@@ -6,17 +6,11 @@
 .. sectionauthor:: Andrew Myers <atmyers2 at gmail.com>
 .. versionadded:: 2.6
 
-.. note:: 
-
-    As of :code:`yt-3.0`, the radial column density analysis module is not
-    currently functional.  This functionality is still available in
-    :code:`yt-2.x`.  If you would like to use these features in :code:`yt-3.x`,
-    help is needed to port them over.  Contact the yt-users mailing list if you
-    are interested in doing this.
-
 `RADMC-3D
-<http://www.ita.uni-heidelberg.de/~dullemond/software/radmc-3d/>`_ is a three-dimensional Monte-Carlo radiative transfer code
-that is capable of handling both line and continuum emission. The :class:`~yt.analysis_modules.radmc3d_export.RadMC3DInterface.RadMC3DWriter`
+<http://www.ita.uni-heidelberg.de/~dullemond/software/radmc-3d/>`_ is a 
+three-dimensional Monte-Carlo radiative transfer code that is capable of 
+handling both line and continuum emission. The 
+:class:`~yt.analysis_modules.radmc3d_export.RadMC3DInterface.RadMC3DWriter`
 class saves AMR data to disk in an ACSII format that RADMC-3D can read. 
 In principle, this allows one to use RADMC-3D to make synthetic observations 
 from any simulation data format that yt recognizes.
@@ -31,74 +25,77 @@
 
 .. code-block:: python
 
-    from yt.mods import *
-    from yt.analysis_modules.radmc3d_export.api import *
+    import yt
+    from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
-Then, define a field that calculates the dust density in each cell. Here, we assume
-a constant dust-to-gas mass ratio of 0.01:
+Then, define a field that calculates the dust density in each cell. Here, we 
+assume a constant dust-to-gas mass ratio of 0.01:
 
 .. code-block:: python
 
     dust_to_gas = 0.01
     def _DustDensity(field, data):
-        return dust_to_gas*data["density"]
-    add_field("DustDensity", function=_DustDensity)
+        return dust_to_gas * data["density"]
+    yt.add_field(("gas", "dust_density"), function=_DustDensity, units="g/cm**3")
 
 Now load up a dataset and call the
 :class:`~yt.analysis_modules.radmc3d_export.RadMC3DInterface.RadMC3DWriter`:
 
 .. code-block:: python
 
-    ds = load("galaxy0030/galaxy0030")
+    ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
     writer = RadMC3DWriter(ds)
     
     writer.write_amr_grid()
-    writer.write_dust_file("DustDensity", "dust_density.inp")
+    writer.write_dust_file(("gas", "dust_density"), "dust_density.inp")
 
-The method write_amr_grid() creates an "amr_grid.inp" file that tells RADMC-3D how
-to interpret the rest of the data, while "dust_density.inp" contains the actual data field. 
+The method write_amr_grid() creates an "amr_grid.inp" file that tells RADMC-3D 
+how to interpret the rest of the data, while "dust_density.inp" contains the 
+actual data field. 
 
-We can also supply temperature information. The following code creates a "DustTemperature"
-field that is constant at 10 K, and saves it into a file called "dust_temperature.inp"
+We can also supply temperature information. The following code creates a 
+"dust_temperature" field that is constant at 10 K, and saves it into a file 
+called "dust_temperature.inp"
 
 .. code-block:: python
 
     def _DustTemperature(field, data):
-        return 10.0*data["Ones"]
-    add_field("DustTemperature", function=_DustTemperature)
+        return 0. * data["temperature"] + data.ds.quan(10, 'K')
+    yt.add_field(("gas", "dust_temperature"), function=_DustTemperature, units="K")
     
-    writer.write_dust_file("DustTemperature", "dust_temperature.inp")
+    writer.write_dust_file(("gas", "dust_temperature"), "dust_temperature.inp")
 
-With the "amr_grid.inp", "dust_density.inp", and "dust_temperature.inp" files, RADMC-3D
-has everything it needs to compute the thermal dust emission (you may also have to include
-the location and spectra of any sources, which currently must be done manually). 
-The result is something that looks like this:
+With the "amr_grid.inp", "dust_density.inp", and "dust_temperature.inp" files, 
+RADMC-3D has everything it needs to compute the thermal dust emission (you may 
+also have to include the location and spectra of any sources, which currently 
+must be done manually).  The result is something that looks like this:
 
 .. image:: _images/31micron.png
 
 Line Emission
 -------------
 
-The file format required for line emission is slightly different. The following script will generate 
-two files, one called "numderdens_co.inp", which contains the number density of CO molecules
-for every cell in the index, and another called "gas-velocity.inp", which is useful if you want 
-to include doppler broadening.
+The file format required for line emission is slightly different. The 
+following script will generate two files, one called "numderdens_co.inp", 
+which contains the number density of CO molecules for every cell in the index, 
+and another called "gas-velocity.inp", which is useful if you want to include 
+doppler broadening.
 
 .. code-block:: python
 
-    from yt.mods import *
-    from yt.analysis_modules.radmc3d_export.api import *
+    import yt
+    from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
     x_co = 1.0e-4
     mu_h = 2.34e-24
     def _NumberDensityCO(field, data):
         return (x_co/mu_h)*data["density"]
-    add_field("NumberDensityCO", function=_NumberDensityCO)
+    yt.add_field(("gas", "number_density_CO"), function=_NumberDensityCO, units="cm**-3")
     
-    ds = load("galaxy0030/galaxy0030")
+    ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
     writer = RadMC3DWriter(ds)
     
     writer.write_amr_grid()
-    writer.write_line_file("NumberDensityCO", "numberdens_co.inp")
+    writer.write_line_file(("gas", "number_density_CO"), "numberdens_co.inp")
     velocity_fields = ["velocity_x", "velocity_y", "velocity_z"]
     writer.write_line_file(velocity_fields, "gas_velocity.inp") 

diff -r c49dbb18e2f0cbc1357be61e77a1757bf4aa47d2 -r 9799455919d22c5c6d6168287bb69439a9fd1962 yt/analysis_modules/radmc3d_export/RadMC3DInterface.py
--- a/yt/analysis_modules/radmc3d_export/RadMC3DInterface.py
+++ b/yt/analysis_modules/radmc3d_export/RadMC3DInterface.py
@@ -13,7 +13,8 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-from yt.mods import *
+import yt
+import numpy as np
 from yt.utilities.lib.write_array import \
     write_3D_array, write_3D_vector_array
 
@@ -86,40 +87,42 @@
     file "dust_density.inp" in a form readable by radmc3d. It will also write
     a "dust_temperature.inp" file with everything set to 10.0 K: 
 
-    >>> from yt.mods import *
-    >>> from yt.analysis_modules.radmc3d_export.api import *
+    >>> import yt
+    >>> from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
     >>> dust_to_gas = 0.01
     >>> def _DustDensity(field, data):
     ...     return dust_to_gas*data["Density"]
-    >>> add_field("DustDensity", function=_DustDensity)
+    >>> yt.add_field("DustDensity", function=_DustDensity)
 
     >>> def _DustTemperature(field, data):
     ...     return 10.0*data["Ones"]
-    >>> add_field("DustTemperature", function=_DustTemperature)
+    >>> yt.add_field("DustTemperature", function=_DustTemperature)
     
-    >>> ds = load("galaxy0030/galaxy0030")
+    >>> ds = yt.load("galaxy0030/galaxy0030")
     >>> writer = RadMC3DWriter(ds)
     
     >>> writer.write_amr_grid()
     >>> writer.write_dust_file("DustDensity", "dust_density.inp")
     >>> writer.write_dust_file("DustTemperature", "dust_temperature.inp")
 
-    This will create a field called "NumberDensityCO" and write it out to
+    ---
+
+    This example will create a field called "NumberDensityCO" and write it out to
     the file "numberdens_co.inp". It will also write out information about
     the gas velocity to "gas_velocity.inp" so that this broadening may be
     included in the radiative transfer calculation by radmc3d:
 
-    >>> from yt.mods import *
-    >>> from yt.analysis_modules.radmc3d_export.api import *
+    >>> import yt
+    >>> from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 
     >>> x_co = 1.0e-4
     >>> mu_h = 2.34e-24
     >>> def _NumberDensityCO(field, data):
     ...     return (x_co/mu_h)*data["Density"]
-    >>> add_field("NumberDensityCO", function=_NumberDensityCO)
+    >>> yt.add_field("NumberDensityCO", function=_NumberDensityCO)
     
-    >>> ds = load("galaxy0030/galaxy0030")
+    >>> ds = yt.load("galaxy0030/galaxy0030")
     >>> writer = RadMC3DWriter(ds)
     
     >>> writer.write_amr_grid()
@@ -183,8 +186,8 @@
         RE   = self.domain_right_edge
 
         # Radmc3D wants the cell wall positions in cgs. Convert here:
-        LE_cgs = LE * self.ds.units['cm']
-        RE_cgs = RE * self.ds.units['cm']
+        LE_cgs = LE.in_units('cm')
+        RE_cgs = RE.in_units('cm')
 
         # calculate cell wall positions
         xs = [str(x) for x in np.linspace(LE_cgs[0], RE_cgs[0], dims[0]+1)]

diff -r c49dbb18e2f0cbc1357be61e77a1757bf4aa47d2 -r 9799455919d22c5c6d6168287bb69439a9fd1962 yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
--- /dev/null
+++ b/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
@@ -0,0 +1,56 @@
+"""
+Unit test for the RADMC3D Exporter analysis module
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2014, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+import yt
+from yt.testing import *
+from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
+from yt.config import ytcfg
+import tempfile
+import os
+import shutil
+
+ISO_GAL = "IsolatedGalaxy/galaxy0030/galaxy0030"
+
+ at requires_file(ISO_GAL)
+def test_radmc3d_exporter_continuum():
+    """
+    This test is simply following the description in the docs for how to
+    generate the necessary output files to run a continuum emission map from
+    dust for one of our sample datasets.
+    """
+
+    # Set up in a temp dir
+    tmpdir = tempfile.mkdtemp()
+    curdir = os.getcwd()
+    os.chdir(tmpdir)
+
+    # Make up a dust density field where dust density is 1% of gas density
+    dust_to_gas = 0.01
+    def _DustDensity(field, data):
+        return dust_to_gas * data["density"]
+    
+    # Make up a dust temperature field where temp = 10K everywhere
+    def _DustTemperature(field, data):
+        return 0.*data["temperature"] + data.ds.quan(10,'K')
+    
+    ds = yt.load(ISO_GAL)
+    ds.add_field(("gas", "dust_density"), function=_DustDensity, units="g/cm**3")
+    ds.add_field(("gas", "dust_temperature"), function=_DustTemperature, units="K")
+    writer = RadMC3DWriter(ds)
+    
+    writer.write_amr_grid()
+    writer.write_dust_file(("gas", "dust_density"), "dust_density.inp")
+    writer.write_dust_file(("gas", "dust_temperature"), "dust_temperature.inp")
+
+    # clean up
+    os.chdir(curdir)
+    shutil.rmtree(tmpdir)

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