{ "info": { "author": "Dan Foreman-Mackey", "author_email": "danfm@nyu.edu", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Topic :: Scientific/Engineering :: Astronomy", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Scientific/Engineering :: Physics" ], "description": "Untrendy\n========\n\nIn an age where studying exoplanets is just the hippest thing ever, sometimes\nit's good to step out of line and be a little untrendy! This library is a set\nof hacks that can robustly remove the out-of-transit trends in light curve\ndata.\n\nInstallation\n------------\n\n**Untrendy** depends on ``numpy`` and ``scipy`` so make sure that you install\nthose first. Then, you can install using ``pip``:\n\n::\n\n pip install untrendy\n\nUsage\n-----\n\n**Untrendy** is really complicated. It has approximately *one* function and\nabout *200 lines of code (including documentation)*. It mostly runs on love\nand magic (more complete details are given below if you want).\n\nLet's say that you have a light curve with time samples ``t``, flux\nmeasurements ``f`` and uncertainties ``sigma``. You can simply run:\n\n.. code-block:: python\n\n import untrendy\n f_detrend, sigma_detrend = untrendy.untrend(t, f, sigma)\n\nto find a robust estimate of the global trends of the time series and remove\nit. The default settings are tuned to work well for finding the\n\"out-of-transit\" trends in Kepler data but a detailed description of the\noptions is listed below. You can also just fit for the trends and get a\ncallable representation of the trend:\n\n.. code-block:: python\n\n trend = untrendy.fit_trend(t, f, ferr)\n\nIn this case, you can find the background level at some time ``t0`` by calling\nthe function:\n\n.. code-block:: python\n\n bkg = trend(t0)\n\nNotes\n-----\n\n1. The spline sometimes goes to hell in regions where you don't have any\n samples so be careful with that.\n2. This whole procedure introduces correlated errors. You've been warned.\n\nCommand Line Untrending\n-----------------------\n\nThere is also the option of using **Untrendy** from the command line if you\ndon't want to bother with all the Python stuff. If you have a whitespace\nseparated ASCII file containing your light curve, you can de-trend it by\nrunning:\n\n::\n\n untrend /path/to/data.txt\n\nThe code will assume that your file has 2 or 3 columns with time, flux and\n(optionally) uncertainties for each observation. Then, the de-trended light\ncurve will be written to standard out in the same format. Alternatively, the\nsame program can read the data right from standard in:\n\n::\n\n cat /path/to/data.txt | untrend\n\nThis gives you the option of doing something crazy and then piping it all\nUNIX-like. Personally, I would just use Python.\n\nAPI\n---\n\nFit the trend\n+++++++++++++\n\n*untrendy.*\\ **fit_trend** (``x``, ``y``, ``yerr=None``, ``Q=12``, ``dt=3.0``,\n``tol=0.00125``, ``maxiter=15``, ``fill_times=None``, ``maxditer=4``,\n``nfill=4``)\n\nUse iteratively re-weighted least squares to fit a spline to the\nout-of-transit trends in a time series. The input data should be \"clean\".\nIn other words, bad data should be masked and it often helps to normalize\nthe fluxes (by the median or something).\n\n**Parameters**\n\n:``x``: The sampled times.\n:``y``: The fluxes corresponding to the times in ``x``.\n:``yerr``: (optional) The 1-sigma error bars on ``y``.\n:``Q``: (optional) The parameter controlling the severity of the\n re-weighting.\n:``dt``: (optional) The initial spacing between time control\n points.\n:``tol``: (optional) The convergence criterion.\n:``maxiter``: (optional) The maximum number of re-weighting iterations\n to run.\n:``fill_times``: (optional) If provided, this number sets the minimum time\n spacing between adjacent samples that is acceptable. If\n the spacing is larger, knots will be added to fill in\n the gap.\n:``maxditer``: (optional) The maximum number of discontinuity search\n iterations to run.\n:``nfill``: (optional) The number of knots to use to fill in the\n gaps.\n\n**Returns**\n\n:``trend``: A callable representation of the trend.\n\nRemove the trend\n++++++++++++++++\n\n*untrendy.*\\ **untrend** (``x``, ``y``, ``yerr=None``, ``**kwargs``)\n\nUse iteratively re-weighted least squares to remove the out-of-transit\ntrends in a light curve. Unlike ``fit_trend``, this function masks bad\ndata (``NaN``) and normalizes the data before fitting.\n\n**Parameters**\n\n:``x``: The sampled times.\n:``y``: The fluxes corresponding to the times in ``x``.\n:``yerr``: (optional) The 1-sigma error bars on ``y``.\n:``**kwargs``: (optional) Other arguments passed to the ``fit_trend``\n function.\n\n**Returns**\n\n:``flux``: The de-trended relative fluxes.\n:``ferr``: The de-trended uncertainties on ``flux``.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dfm/untrendy", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "untrendy", "package_url": "https://pypi.org/project/untrendy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/untrendy/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/dfm/untrendy" }, "release_url": "https://pypi.org/project/untrendy/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "De-trending Kepler light curves in style", "version": "0.0.2" }, "last_serial": 801249, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "e62ce7f45faa5433c21c23f6b95ad8b6", "sha256": "575e84df1206db7dae224838f31064eb610d480cf2f86841bdcae46196dc97a8" }, "downloads": -1, "filename": "untrendy-0.0.1.tar.gz", "has_sig": false, "md5_digest": "e62ce7f45faa5433c21c23f6b95ad8b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6669, "upload_time": "2013-04-10T14:50:12", "url": "https://files.pythonhosted.org/packages/fd/2e/32b8cac09bed88007ca7f207e28274908802556f13871106c68ca432246c/untrendy-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "919b3a3a50bb42a6b64ef4f49c3c7350", "sha256": "ee115048be4d4b5848f550cd2bc72c214d551ef20bb16d814be6349c7bf63071" }, "downloads": -1, "filename": "untrendy-0.0.2.tar.gz", "has_sig": false, "md5_digest": "919b3a3a50bb42a6b64ef4f49c3c7350", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47169, "upload_time": "2013-04-25T21:04:53", "url": "https://files.pythonhosted.org/packages/03/50/0e72b215a681219f3e40139807312dc9df4200a33abf0f4d19947aba46ae/untrendy-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "919b3a3a50bb42a6b64ef4f49c3c7350", "sha256": "ee115048be4d4b5848f550cd2bc72c214d551ef20bb16d814be6349c7bf63071" }, "downloads": -1, "filename": "untrendy-0.0.2.tar.gz", "has_sig": false, "md5_digest": "919b3a3a50bb42a6b64ef4f49c3c7350", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 47169, "upload_time": "2013-04-25T21:04:53", "url": "https://files.pythonhosted.org/packages/03/50/0e72b215a681219f3e40139807312dc9df4200a33abf0f4d19947aba46ae/untrendy-0.0.2.tar.gz" } ] }