Git Product home page Git Product logo

wakeflow's Introduction

PyPI Package Python License JOSS

GitHub Workflow Status Docs


Logo

Generate and manipulate semi-analytic models of planet wakes

Quickstart tutorial »
Documentation »

Overview

wakeflow is a Python package primarily for calculating tidally-induced perturbations resulting from a planet embedded in a gas disk. It is an implementation of both the linear theory for planet wake generation (Goldreich and Tremaine 1979) and the non-linear theory of wake propagation (Rafikov 2002) in 2D. wakeflow lets you generate these models by specifying disk and system properties as typically parameterised in the planet formation literature. It also contains additional tools allowing you to:

  • Visualise your results
  • Create 3D models under some assumptions
  • Interface directly with the radiative transfer code MCFOST to generate synthetic images of these models
  • (Planned) Rotate and project your models to create line-of-sight maps of velocity perturbations at some emitting layer
  • (Planned) Create analytic predictions for peak velocity maps as found in Calcino et al. 2022

wakeflow is intended to allow both theorists and observers to easily generate models of the interaction between disks and embedded planets, instead of having to run expensive fluid simulations. In particular, wakeflow allows researchers to easily test whether a planet can explain kinematic perturbations observed in some set of disk observations, so-called velocity kinks (see for example Pinte et al. 2018). wakeflow therefore also allows for a fast exploration of disk and planet parameters in order to determine those most likely to recreate observations, before resources are spent on 3D simulations. In addition, wakeflow models may be used with MCFOST to create synthetic images that may be compared directly with observations.

(back to top)

Installation

wakeflow may be most easily installed from the Python Package Index (PyPI), or can also be installed from the GitHub repository if you wish to make contributions. Dependencies for wakeflow consist mostly of standard python libraries. We recommend using a package manager such as Anaconda to make your life easier, but this is not required.

PyPI (pip)

The easiest way to install wakeflow is via PyPI, using pip:

pip install wakeflow

that's it!

From source (GitHub)

If you want to contribute to, or modify wakeflow, you should install it from the GitHub repository. After installing the dependencies (see below), simply fork the repo using the button in the top right, and then clone it:

git clone https://github.com/<replace-by-your-username>/wakeflow.git

Alternatively, you may install from source even if you do not wish to edit wakeflow, in which case I would recommend skipping the fork and simply cloning the repo directly:

git clone https://github.com/TomHilder/wakeflow.git

Navigate to the directory it is installed in:

cd wakeflow

You can verify that you are in the correct directory by checking that you see README.md when you run:

ls

Now we use pip to create a local and editable install of wakeflow:

python -m pip install -e .

Do not forget the dot (.) in the above command, as it tells pip to look in the current working directory (where wakeflow is). The advantage of installing this way is that it places a link to wakeflow in your site-packages folder instead of moving it there. Now when you edit the code in wakeflow/src/wakeflow/ it will edit your installation!

(back to top)

Dependencies

Python packages:

  • numpy
  • matplotlib
  • astropy
  • scipy
  • setuptools
  • pyyaml
  • tqdm
  • pytest (optional)
  • pytest-cov (optional)
  • pymcfost (optional, only if interfacing with MCFOST)

If you install wakeflow using pip then the required dependencies will be automatically installed.

Usage

Please refer to the Quickstart tutorial for the most typical usage of wakeflow including generating models and reading the results. Additional examples of more advanced usage can be found in the Documentation.

(back to top)

Testing

wakeflow is automatically unit-tested on Github using Actions and tox. If you have installed wakeflow from source, you may run a local test on your machine provided that you have pytest and pytest-cov installed. Simply navigate to your installation directory and run:

pytest

Contributing

Contributions to wakeflow are welcome. If you would like to implement a new feature, please:

  1. Install using the above installation from source instructions
  2. Create your Feature Branch (git checkout -b feature/NewFeature)
  3. Commit your Changes (git commit -m 'Added some NewFeature')
  4. Push to the Branch (git push origin feature/NewFeature)
  5. Open a Pull Request

If you have a suggestion that would improve wakeflow but do not have the time or means to implement it yourself, please simply open an issue with the tag "enhancement". If you would like to report a bug, please open an issue with the tag "bug".

Don't forget to give the project a star!

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Citing

Please cite Hilder et al. (2023) and Bollati et al. (2021) in any work where wakeflow has been used. Please contact us if wakeflow is useful to you, we welcome any collaboration opportunities.

(back to top)

Getting Help

If you are experiencing issues with wakeflow, please try the following:

  1. Check the documentation to see if it may be easily resolved
  2. Open an issue on the repository
  3. Feel free to contact us directly using the details below

Contact

If you are having difficulties installing or using wakeflow, please let us know! We are happy to answer any questions or provide assistance.

Thomas Hilder - [email protected]

Project Link: https://github.com/TomHilder/wakeflow

(back to top)

Acknowledgments

wakeflow is based on the semi-analytic theory of planets wakes described in Rafikov (2002) and Bollati et al. (2021). The code is partially adapted from analytical kinks which was written by Francesco Bollati, Daniele Fasano and Thomas Hilder, and can be found here.

Additional acknowledgements:

(back to top)

wakeflow's People

Contributors

cpinte avatar crislong avatar danielefasano avatar dfm avatar jacobvandenberg avatar tomhilder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

wakeflow's Issues

[enhancement] Improve user-interface for generating models

The interface should be changed so that it does not require writing and reading files at all. The output data of wakeflow is small enough to be sensibly kept in memory, for instance for use in a self-contained script, or an Jupyter notebook for analysis.

This is sort of already implemented in wakefit_interface.py, but it’s not done all that well and also is not accessible to the user easily right now.

This would be a relatively straight-forward change, but it should be left until after the new features from #21 have been merged.

[enhancement] Planet location

Please consider having the position angle of the planet (PAp) as an optional argument in wakeflow too (i.e. not only for the interface with MCFOST). This will make it easier to compare output velocities to actual observations and will also facilitate the link between wakeflow and other codes in the community such as eddy or discminer.

openjournals/joss-reviews#4863

[enhancement] Finish porting `spiralmoments`

The part of spiralmoments that allows to read-in velocity field data and rotate/project it should also be ported. It should be easy for the user to generate a peak-velocity map prediction by having spiralmoments call wakeflow for them, or similar. This will likely require #26 to be completed first.

After this, the README should be updated to reflect the fact that spiralmoments has been ported completely. A Jupyter notebook with examples should also be added to the docs.

Can only make results with anti-clockwise rotation

Fixing the inner wake evolution broke the ability to have both clockwise and anti-clockwise rotating disks.

This should be fixed by rotating the results appropriately at the end, if the use has specified clockwise. It is too much of a pain to keep track of a minus sign throughout the whole calculation.

[documentation] Various suggestions

  • Missing density units in 'Wakeflow Parameters' section.
  • In the tutorial consider using ax.contourf(X[:,i,:], Y[:,i,:], rho[:,i,:], levels=256) instead of ax.pcolormesh to avoid confusion with the order of x, y axes and the need to use the transpose of rho. Note that pcolormesh is intended for irregular rectangular grids and thus not really needed here.
  • In the tutorial please consider adding a few words explaining why having a planet-to-thermal mass ratio > 1 may lead to unreliable results in the analytical framework.
  • In the 'Disk Structure' section you should explicitly mention that the additional factor in the rotation velocity is due to the presence of radial pressure forces and provide actual link(s) to the reference(s) e.g. Nelson et al. 2013.
  • A few more details should be added as to what the user is seeing as output. For instance, in the tutorial you show an example of how to plot the resulting density field at different scale heights which may give the wrong impression that the velocity field can also vary as function of height (which is not accounted by the analytical theory in which the code is based). In this case please remind the user that the output velocity field is computed for the disc midplane only.

openjournals/joss-reviews#4863

[enhancement] Sanity checking `H/r_p` for user-specified global linear perturbations

Quoted from PR #21 :

Tom: I feel there needs to be a further sanity-check/warning in the case that the user is providing either global or simulation perturbations. H/r_p needs to be identical in the provided data and as specified to wakeflow no? It would be good to really reinforce this to the user (obviously we can't actually check the H/r_p in the linear perturbations they provide).

Daniele: Actually we could do something about it, maybe we can work on this together when you are in nice. Andrés is parsing the log files in discminer, checking if they are compliant with the standard nomenclature. We could change the names of the perturbations accounting for the different parameters and parse the name of the files, checking if H/r_p is actually the same

[question] Grid vertical extent

Why is the maximum vertical extent of the grid fixed to one pressure scale height (at R_out)? To date the majority of velocity kinks reported in the literature have been identified in 12CO, which is normally between 2-4H over the disc midplane, and at large radial separations. I would then suggest you to make z_max an optional argument too with a default value of e.g. 3H at R_out.

openjournals/joss-reviews#4863

[enhancement] Improve `mcfost` interface to allow users to edit .para file parameters

The interface to mcfost should be changed such that wakeflow only specifies the strictly required parameters from the .para config file for mcfost.

Currently, wakeflow tells mcfost the necessary grid and physics, but also guesses some other parameters that are probably sensible for the user but potentially not desired. It is also NOT documented what these are and why they are the specific values. This is definitely poor practice. This should be changed such that besides the required physics parameters, the other parameters are (somehow) set by the user. Probably just by having them provide a .para file, where the necessary parameters are overridden by wakeflow.

Additionally, the mcfost parameter file is currently distributed with wakeflow. This is bad practice. wakeflow should include a script to download the .para file using the user's mcfost installation.

Finally, mcfost should be called using the run function from pymcfost instead of using a sys call to mcfost. This is more effectively future-proof as pymcfost is more likely to be updated as required than wakeflow's interface. It would also allow the user to pass through additional keywords for calling mcfost as they are arguments in the pymcfost function.

[enhancement] Improve warnings and exceptions system

wakeflow errors and warnings should be changed to adhere to standard Python conventions.

Currently, wakeflow uses print statements to warn users about certain parameter choices, and generic Exceptions for incompatible or otherwise non-sensical parameter choices. This does not really adhere to standard practice; warnings.warn should be used for the warnings, and more specific errors should be used instead of Exceptions. For example ValueError for a bad parameter choice. The current implementation is due to my limited knowledge of error handling at the time I wrote the code. Users should be able to catch certain warnings and errors and handle them appropriately if they desire, which is impossible in the current implementation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.