{"id":13528656,"url":"https://github.com/stringertheory/traces","last_synced_at":"2026-04-10T10:02:45.660Z","repository":{"id":28708508,"uuid":"32229117","full_name":"stringertheory/traces","owner":"stringertheory","description":"A Python library for unevenly-spaced time series analysis","archived":false,"fork":false,"pushed_at":"2026-02-02T03:01:01.000Z","size":3747,"stargazers_count":553,"open_issues_count":35,"forks_count":58,"subscribers_count":12,"default_branch":"main","last_synced_at":"2026-03-30T21:03:35.118Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://traces.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stringertheory.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-03-14T19:49:39.000Z","updated_at":"2026-02-08T14:29:38.000Z","dependencies_parsed_at":"2024-02-03T06:29:26.947Z","dependency_job_id":"5139d896-3dc1-4c24-8257-a2b522cadc00","html_url":"https://github.com/stringertheory/traces","commit_stats":null,"previous_names":["stringertheory/traces","datascopeanalytics/traces"],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/stringertheory/traces","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stringertheory%2Ftraces","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stringertheory%2Ftraces/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stringertheory%2Ftraces/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stringertheory%2Ftraces/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stringertheory","download_url":"https://codeload.github.com/stringertheory/traces/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stringertheory%2Ftraces/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31637748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:22.412Z","updated_at":"2026-04-10T10:02:45.636Z","avatar_url":"https://github.com/stringertheory.png","language":"Python","readme":"\u003c!-- [![Version](https://img.shields.io/pypi/v/traces.svg?)](https://pypi.python.org/pypi/traces) --\u003e\n\u003c!-- [![PyVersions](https://img.shields.io/pypi/pyversions/traces.svg)](https://pypi.python.org/pypi/traces) --\u003e\n\u003c!-- [![Documentation Status](https://readthedocs.org/projects/traces/badge/?version=master)](https://traces.readthedocs.io/en/master/?badge=master) --\u003e\n\u003c!-- [![Release](https://img.shields.io/github/v/release/stringertheory/traces)](https://img.shields.io/github/v/release/stringertheory/traces) --\u003e\n\n[![Build status](https://img.shields.io/github/actions/workflow/status/stringertheory/traces/main.yml?branch=main)](https://github.com/stringertheory/traces/actions/workflows/main.yml?query=branch%3Amain)\n[![codecov](https://codecov.io/gh/stringertheory/traces/branch/main/graph/badge.svg)](https://codecov.io/gh/stringertheory/traces)\n[![Commit activity](https://img.shields.io/github/commit-activity/y/stringertheory/traces)](https://img.shields.io/github/commit-activity/m/stringertheory/traces)\n\n# traces\n\nA Python library for unevenly-spaced time series analysis.\n\n## Why?\n\nTaking measurements at irregular intervals is common, but most tools are\nprimarily designed for evenly-spaced measurements. Also, in the real\nworld, time series have missing observations or you may have multiple\nseries with different frequencies: it can be useful to model these as\nunevenly-spaced.\n\nTraces was designed by the team at\n[Datascope](\u003c[https://datascopeanalytics.com/](https://en.wikipedia.org/wiki/Datascope_Analytics)\u003e) based on several practical\napplications in different domains, because it turns out [unevenly-spaced\ndata is actually pretty great, particularly for sensor data\nanalysis](https://traces.readthedocs.io/).\n\n## Installation\n\nTo install traces, run this command in your terminal:\n\n```shell\n$ pip install traces\n```\n\n## Quickstart: using traces\n\nTo see a basic use of traces, let's look at these data from a light\nswitch, also known as _Big Data from the Internet of Things_.\n\n![](docs/_static/img/trace.svg)\n\nThe main object in traces is a [TimeSeries](https://traces.readthedocs.io/en/master/api_reference.html#timeseries), which you\ncreate just like a dictionary, adding the five measurements at 6:00am,\n7:45:56am, etc.\n\n```pycon\n\u003e\u003e\u003e time_series = traces.TimeSeries()\n\u003e\u003e\u003e time_series[datetime(2042, 2, 1,  6,  0,  0)] = 0 #  6:00:00am\n\u003e\u003e\u003e time_series[datetime(2042, 2, 1,  7, 45, 56)] = 1 #  7:45:56am\n\u003e\u003e\u003e time_series[datetime(2042, 2, 1,  8, 51, 42)] = 0 #  8:51:42am\n\u003e\u003e\u003e time_series[datetime(2042, 2, 1, 12,  3, 56)] = 1 # 12:03:56am\n\u003e\u003e\u003e time_series[datetime(2042, 2, 1, 12,  7, 13)] = 0 # 12:07:13am\n```\n\nWhat if you want to know if the light was on at 11am? Unlike a python\ndictionary, you can look up the value at any time even if it's not one\nof the measurement times.\n\n```pycon\n\u003e\u003e\u003e time_series[datetime(2042, 2, 1, 11,  0, 0)] # 11:00am\n0\n```\n\nThe `distribution` function gives you the fraction of time that the\n`TimeSeries` is in each state.\n\n```pycon\n\u003e\u003e\u003e time_series.distribution(\n\u003e\u003e\u003e   start=datetime(2042, 2, 1,  6,  0,  0), # 6:00am\n\u003e\u003e\u003e   end=datetime(2042, 2, 1,  13,  0,  0)   # 1:00pm\n\u003e\u003e\u003e )\nHistogram({0: 0.8355952380952381, 1: 0.16440476190476191})\n```\n\nThe light was on about 16% of the time between 6am and 1pm.\n\n### Adding more data...\n\nNow let's get a little more complicated and look at the sensor readings\nfrom forty lights in a house.\n\n![](docs/_static/img/traces.svg)\n\nHow many lights are on throughout the day? The merge function takes the\nforty individual `TimeSeries` and efficiently merges them into one\n`TimeSeries` where the each value is a list of all lights.\n\n```pycon\n\u003e\u003e\u003e trace_list = [... list of forty traces.TimeSeries ...]\n\u003e\u003e\u003e count = traces.TimeSeries.merge(trace_list, operation=sum)\n```\n\nWe also applied a `sum` operation to the list of states to get the\n`TimeSeries` of the number of lights that are on.\n\n![](docs/_static/img/count.svg)\n\nHow many lights are on in the building on average during business hours,\nfrom 8am to 6pm?\n\n```pycon\n\u003e\u003e\u003e histogram = count.distribution(\n\u003e\u003e\u003e   start=datetime(2042, 2, 1,  8,  0,  0),   # 8:00am\n\u003e\u003e\u003e   end=datetime(2042, 2, 1,  12 + 6,  0,  0) # 6:00pm\n\u003e\u003e\u003e )\n\u003e\u003e\u003e histogram.median()\n17\n```\n\nThe `distribution` function returns a [Histogram](https://traces.readthedocs.io/en/master/api_reference.html#histogram) that\ncan be used to get summary metrics such as the mean or quantiles.\n\n### It's flexible\n\nThe measurements points (keys) in a `TimeSeries` can be in any units as\nlong as they can be ordered. The values can be anything.\n\nFor example, you can use a `TimeSeries` to keep track the contents of a\ngrocery basket by the number of minutes within a shopping trip.\n\n```pycon\n\u003e\u003e\u003e time_series = traces.TimeSeries()\n\u003e\u003e\u003e time_series[1.2] = {'broccoli'}\n\u003e\u003e\u003e time_series[1.7] = {'broccoli', 'apple'}\n\u003e\u003e\u003e time_series[2.2] = {'apple'}          # puts broccoli back\n\u003e\u003e\u003e time_series[3.5] = {'apple', 'beets'} # mmm, beets\n```\n\n## More info\n\nTo learn more, check the [examples](https://traces.readthedocs.io/en/master/examples.html) and the detailed [reference](https://traces.readthedocs.io/en/master/api_reference.html#).\n\n## Contributing\n\nContributions are welcome and greatly appreciated! Please visit our [guidelines](https://github.com/datascopeanalytics/traces/blob/master/CONTRIBUTING.md)\nfor more info.\n","funding_links":[],"categories":["Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstringertheory%2Ftraces","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstringertheory%2Ftraces","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstringertheory%2Ftraces/lists"}