{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Command-line interface to tidynamics\n\nThe program reads in data from the file input_file (using np.loadtxt from\nNumPy) and performs the selected action on the data, chosen in:\n\n* acf for the autocorrelation function\n* msd for the mean-square displacement\n\nThe program writes the result in the file output_file using the function\nnp.savetxt from NumPy.\n\nFor more information, consult the documentation of tidynamics at\nhttp://lab.pdebuyl.be/tidynamics/\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import argparse\nimport numpy as np\nimport tidynamics\n\n\nparser = argparse.ArgumentParser(description=__doc__,\n                        formatter_class=argparse.RawDescriptionHelpFormatter)\nparser.add_argument('action',\n                    help='Choice of computation to perform on input file',\n                    choices=['acf', 'msd'])\nparser.add_argument('input_file',\n                    help='Filename for input data')\nparser.add_argument('output_file',\n                    help='Filename for the result of the computation')\nargs = parser.parse_args()\n\ninput_data = np.loadtxt(args.input_file)\n\nif args.action == 'acf':\n    result = tidynamics.acf(input_data)\nelif args.action == 'msd':\n    result = tidynamics.msd(input_data)\n\nnp.savetxt(args.output_file, result)"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.11.2"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}