.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/tidynamics_tool.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_tidynamics_tool.py: ==================================== Command-line interface to tidynamics ==================================== The program reads in data from the file input_file (using np.loadtxt from NumPy) and performs the selected action on the data, chosen in: * acf for the autocorrelation function * msd for the mean-square displacement The program writes the result in the file output_file using the function np.savetxt from NumPy. For more information, consult the documentation of tidynamics at http://lab.pdebuyl.be/tidynamics/ .. GENERATED FROM PYTHON SOURCE LINES 20-45 .. code-block:: default import argparse import numpy as np import tidynamics parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('action', help='Choice of computation to perform on input file', choices=['acf', 'msd']) parser.add_argument('input_file', help='Filename for input data') parser.add_argument('output_file', help='Filename for the result of the computation') args = parser.parse_args() input_data = np.loadtxt(args.input_file) if args.action == 'acf': result = tidynamics.acf(input_data) elif args.action == 'msd': result = tidynamics.msd(input_data) np.savetxt(args.output_file, result) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _sphx_glr_download_auto_examples_tidynamics_tool.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: tidynamics_tool.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: tidynamics_tool.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_