# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['plutoplot']

package_data = \
{'': ['*']}

install_requires = \
['matplotlib>=3.3,<4.0', 'numpy>=1.19,<2.0']

extras_require = \
{'hdf5': ['h5py>=3.0,<4.0'], 'interactive': ['ipywidgets>=7.0,<8.0']}

entry_points = \
{'console_scripts': ['pluto-format-ini = plutoplot.scripts:format_ini',
                     'pluto-info = plutoplot.info:main']}

setup_kwargs = {
    'name': 'plutoplot',
    'version': '0.3.2',
    'description': 'Python package to load PLUTO simulation data',
    'long_description': '# plutoplot - Plutocode data loading and plotting library\n![GitHub release](https://img.shields.io/github/v/release/simske/plutoplot?include_prereleases&label=Github%20Release)\n![PyPI](https://img.shields.io/pypi/v/plutoplot)\n[![Documentation](https://readthedocs.org/projects/plutoplot/badge/?version=latest)](https://plutoplot.readthedocs.io/en/latest/?badge=latest)\n[![pre-commit](https://github.com/Simske/plutoplot/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/Simske/plutoplot/actions/workflows/pre-commit.yml)\n[![testing](https://github.com/Simske/plutoplot/actions/workflows/tox.yml/badge.svg)](https://github.com/Simske/plutoplot/actions/workflows/tox.yml)\n![License](https://img.shields.io/github/license/simske/plutoplot)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n\n`plutoplot` is a Python package for loading, analyzing and plotting data from the [astrophysical gas dynamics simulation code PLUTO](http://plutocode.ph.unito.it/).\nBy handling simulations as a whole and loading data only when needed (lazy loading), it is fast and easy to use.\n\nIt features:\n- Loading on data actually needed (by lazy loading in memory mapping)\n- easy slicing into large datasets (e.g. plotting 2D slice of 3D dataset)\n- plotting non-cartesian coordinates projected into cartesian space\n- interactive plotting in Jupyter Notebooks\n- CLI tool to quickly acquire information about simulations\n- Access to parameters set in `definitions.h` and `pluto.ini`\n- Access to simulation metadata and grid properties\n- Indexing with `ijk` (like `pyPLUTO`) and `kji` (like PLUTO internally) schemes\n\nThere is currently no support for:\n- Particles\n- Adaptive grids (AMR)\n- 3D plotting (only plotting 2D slices of 3D data is supported.)\n\nTo get started with `plutoplot` check out the [documentation](https://plutoplot.readthedocs.io/en/latest/) and [examples](https://github.com/Simske/plutoplot/tree/main/test).\n\n## Installation\n`plutoplot` requires Python >=3.6. Make sure for installation to install in the right environment, and/or adapt the pip commands accordingly (e.g. `pip3`).\n\nThe base version of plutoplot can be installed from Pypi with:\n```bash\npip install --upgrade plutoplot\n```\n\nTo keep the installation size small the dependencies for interactive plotting and loading of HDF5 data are declared as optional dependencies.\nTo install the optional dependencies use either of the following, depeding on your needs:\n```bash\npip install --upgrade plutoplot[interactive]\npip install --upgrade plutoplot[hdf5]\npip install --upgrade plutoplot[interactive,hdf5]\n```\n\nTo install the current development version from this branch:\n```bash\npip install --upgrade "plutoplot @ git+https://github.com/simske/plutoplot"\n```\n\n## Quick Start\n### CLI: check simulation info\nTo quickly check the status of a PLUTO simulation, you can use the `pluto-info` command line tool:\n```bash\npluto-info /path/to/simulation\n```\nSample:\n```\n>> pluto-info test-problems/HD/Jet/01/\nPLUTO simulation at \'test-problems/HD/Jet/01\'\nPolar grid with dimensions (160, 1, 640)\nDomain: x1: 0.00e+00 .. 1.00e+01 (Lx1 = 1.00e+01)\n        x2: 0.00e+00 .. 1.00e+00 (Lx2 = 1.00e+00)\n        x2: 0.00e+00 .. 4.00e+01 (Lx3 = 4.00e+01)\nAvailable variables: rho vx1 vx2 vx3 prs\nData files:\n    Format dbl: 16 files, last time 15.0, data timestep 1.00e+00\n    Format flt: 61 files, last time 15.0, data timestep 2.50e-01\n\n```\n(note: depending on your Python environment, the entrypoint `pluto-info` might not be installed correctly. Check the [documentation for more details](https://plutoplot.readthedocs.io/en/latest/cli-tools)).\n\n### Quick start in Python scripts / Jupyter notebooks\n```python\nimport plutoplot as pp\n```\n#### Basics\nSimulations can be loaded by just providing the path to the simulation directory (directory with `definitions.h` and `pluto.ini`).\nThe data directory is the found automatically, as well as the grid geometry.\nThe formats are searched in the order (dbl, flt, vtk, dbl.h5, flt.h5) and the first found loaded, this can be overriden.\n```python\nsim = pp.Simulation("/path/to/simulation", format="flt")\n```\nThe simulation object provides access to all outputs (of this format), the grid and simulation metadata.\nA few examples of accesible attributes:\n```python\nsim.dims                  # domain resolution\nsim.x1, sim.x2, sim.x3    # cell centered coordinates, redirect to sim.grid.x{1,2,3}\nsim.x1i, sim.x2i, sim.x3i # cell interface coordinates\nsim.Lx1, sim.Lx2, sim.Lx3\n\nsim.t                     # simulation output times\nsim.vars                  # simulation output variables\n```\n\nThe data at the specific output steps can be accessed with the `sim[n]` syntax.\nThis results in a `PlutoData` object, which can be used to access the data:\n```python\nsim[-1].rho\n```\nThe data object as well as the data array are generated when needed, and the data arrays are memory mapped, which means only data actually accessed is read from disk.\nThe names of the data variables can be found with `sim.vars`.\n\nBe aware that data arrays are always 3-dimensional, even if the domain has a resolution of 1 in some directions.\nThis is for clarity and consistency, so that an axis always has a direct correspondence to its coordinates in the grid.\n\nSimulations are iterable:\n```python\nfor step in sim:\n    print("Total mean squared velocity at t={step.t}: ", (step.vx1**2 + step.vx2**2 + step.vx3**2).mean())\n```\nAnd also provide a `reduce()` function to run over the whole simulation:\n```python\nprs_mean = sim.reduce(lambda step: step.prs.mean())\n```\nThis results in an array containing the output of the supplied function for each step, in the example the mean pressure.\n\n#### Working with simulation slices\nTo only look at a part of a simulation we can slice into it.\nThis can be particularly useful for analyzing and plotting 2D slices of 3D data, as full 3D plotting is not supported yet.\nTo slice into a simulation the usual slicing syntax on `Simulation.slicer`:\n```python\nsliced_sim = sim.slicer[:,0,32:64]\n```\nThis sliced simulation object can now be used as the normal simulation object.\nThe grid and data arrays will automatically return the data for this slice.\n(Note: for clarity a 3D slice is always required. The data arrays will still always be 3D, see above).\n\n#### Plotting\n`plutoplot` provides automatic plotting for 1D & 2D simulations.\nTo plot slices of 3D simulations, first create a simulation slice (section above), then just follow normally.\n\nThe PlutoData object provides a `plot()` function, which will automatically project the data onto a cartesian grid, and annotating the axes and colorbar correctly:\n```python\nsim[-1].plot(\'rho\')\n```\n![Density plot](docs/docs/img/quick_start_plot_projected.jpg)\n\nThe projection can also be turned off, an arbitrary options which will be passed to matplotlib can be given:\n```python\nsim[-1].plot(\'rho\', projection=False)\n```\n![Density plot](docs/docs/img/quick_start_plot_not-projected.jpg)\n\nIf a plot of a custom quantitity is needed, a array instead of a variable name can be given:\n```\nstep = sim[-1]\nstep.plot(step.prs / step.rho, label="T")\n```\n\nIn Jupyter Notebooks interactive plotting can be used to step through the simulation steps.\n`Simulation.iplot()` has the same interface as `PlutoData.plot()`, but it will show a slider to step through simulation steps:\n```\nsim.iplot("rho")\n```\n![Interactive plot](docs/docs/img/quick_start_iplot.gif)\n\n## Testing\nThe test suite for `plutoplot` can be found in `test/` and is run by Github actions using `tox` and `pytest`.\n\nThe test suite is currently minimal and has low code coverage. It will be expanded in the future to ensure correctness.\n\n## Contributing\nIf you have any questions, suggestions or find a bug, feel free to open an [issue](https://github.com/Simske/plutoplot/issues)\nor [Pull Request](https://github.com/Simske/plutoplot/pulls), I am happy to accept contributions to make plutoplot better.\n\n`plutoplot` uses [pre-commit](https://pre-commit.com/) to ensure a consistend code style, please use it when opening a Pull Request.\n\n## License\nGPLv3\n',
    'author': 'Simeon Doetsch',
    'author_email': 'science@simske.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/Simske/plutoplot',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'extras_require': extras_require,
    'entry_points': entry_points,
    'python_requires': '>=3.7,<3.11',
}


setup(**setup_kwargs)
