Skip to content
Thomas Robitaille edited this page Apr 19, 2012 · 3 revisions

In this release, I have tried to tidy things up as much as possible ahead of the release, and in the process, have had to break backward compatibility to implement some useful features. Since I am breaking backward compatibility, I tried to make as many of the big changes as possible in this version, so as not to have to make any major changes to the API in future.

As a result, old input and output files will no longer work in 0.8.5. Similarly, all the old dust files need to be updated. If I previously sent you a dust file, let me know, and I'll send you an updated version. If you generated a dust file yourself, you will need to re-generate it once you have updated Hyperion.

There were no major bugs found in the process of making all these changes, so previous results are still valid. If you are reaching the end of a project, you may as well wait until after this is done to upgrade, as you will need to update a few things in your scripts once you have upgraded. The following sections describe changes in the API, as well as some of the new features.

Changes in the API

  • When post-processing the results, you should no longer use the Model class to read in the output, but the ModelOutput class::

      from hyperion.model import ModelOutput
    
      m = ModelOutput(...)
      wav, nufnu = m.get_sed(...)
    

    If you were doing post-processing using the same model object as you used to run the model, e.g.::

      m = Model(...)
      ...
      m.write(...)
      m.run(...)
      m.get_sed(...)
    

    you should now switch to doing::

      m = Model(...)
      ...
      m.write(...)
      m = m.run(...)
      m.get_sed(...)
    

    because at the run stage, m.run(...) now returns a ModelOutput object.

  • If you ever specify group=... in get_sed or get_image, you need to decrease the group number being specified by one, as group is not zero-based to be more consistent with Python notation. Therefore, group=0 is the first group (and is the default).

  • You no longer have to give a name to the model. You can instead do::

      m = Model()
      ...
      m.write('model.rtin')  # name of the input file to the code
      m.run('model.rtout')  # name of the output file from the code
    

    and you don't have to use matching names for write and run. You don't even have to use the rtin or rtout extensions, but I recommend that you do for clarity.

  • Output files now automatically contains a copy of the input file, so that even if the input file is lost, all the information is in the output file. This does mean that files take more space though, so if you don't want this behavior, do::

      m.set_copy_input(False)
    

    Note that if you are not using the most recent versions of HDF5 (1.8.6 or later), the code will link instead of copying anyway, because there are issues with the copy functionality in older versions of HDF5.

  • If you were using the copy_dust= argument in write previously, this has been changed to just copy=. The default is now true, i.e. dust files are copied into the input files by default.

  • IsotropicSphericalDust is now IsotropicDust, and please note that the arguments for this class are now (nu, albedo, chi), instead of (wav, chi, albedo).

  • SimpleSphericalDust has been renamed to TTsreDust

  • There is a new class named HenyeyGreensteinDust, which takes (nu, albedo, chi, g, p_lin_max).

New features

  • You can specify overwrite=True in write and run if you want to automatically overwrite files.

  • You can now run Hyperion for both serial and parallel jobs using the hyperion command. For serial jobs::

      hyperion model.rtin model.rtout
    

    and for parallel jobs::

      hyperion -m <n_processes> model.rtin model.rtout
    

    where <n_processes> is the number of processes you want to run Hyperion with.

  • If you set up a model with a specific geometry, you can always tell another model to just use the same geometry::

      m = Model(...)
      m.set_cartesian_grid(...)
      m.write('model.rtin')
    
      m2 = Model(...)
      m2.use_geometry('model.rtin')
      m2.write('model2.rtin)
    

    Similarly, you can also just read in the specific energy and densities from an output file, which means you can easily separate the calculation of the initial iterations, and the calculation of the images/SEDs::

      m = Model(...)
      m.use_geometry('model.rtout')
      m.use_quantities('model.rtout')
      ...
      m.write('model.rtin')
    

    This will work for all grid types, including AMR grids and Octree grids (this is one of the features that required the most under-the-hood changes).

Clone this wiki locally