Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
stringertheory committed Feb 4, 2024
1 parent 2c191d0 commit 8f8b136
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# traces

<!-- [![Version](https://img.shields.io/pypi/v/traces.svg?)](https://pypi.python.org/pypi/traces) -->
<!-- [![PyVersions](https://img.shields.io/pypi/pyversions/traces.svg)](https://pypi.python.org/pypi/traces) -->
<!-- [![Documentation Status](https://readthedocs.org/projects/traces/badge/?version=master)](https://traces.readthedocs.io/en/master/?badge=master) -->
Expand All @@ -9,6 +7,8 @@
[![codecov](https://codecov.io/gh/stringertheory/traces/branch/main/graph/badge.svg)](https://codecov.io/gh/stringertheory/traces)
[![Commit activity](https://img.shields.io/github/commit-activity/y/stringertheory/traces)](https://img.shields.io/github/commit-activity/m/stringertheory/traces)

# traces

A Python library for unevenly-spaced time series analysis.

## Why?
Expand All @@ -29,7 +29,7 @@ analysis](https://traces.readthedocs.io/).

To install traces, run this command in your terminal:

```bash
```shell
$ pip install traces
```

Expand All @@ -44,7 +44,7 @@ The main object in traces is a [TimeSeries](https://traces.readthedocs.io/en/mas
create just like a dictionary, adding the five measurements at 6:00am,
7:45:56am, etc.

```python
```pycon
>>> time_series = traces.TimeSeries()
>>> time_series[datetime(2042, 2, 1, 6, 0, 0)] = 0 # 6:00:00am
>>> time_series[datetime(2042, 2, 1, 7, 45, 56)] = 1 # 7:45:56am
Expand All @@ -57,15 +57,15 @@ What if you want to know if the light was on at 11am? Unlike a python
dictionary, you can look up the value at any time even if it's not one
of the measurement times.

```python
```pycon
>>> time_series[datetime(2042, 2, 1, 11, 0, 0)] # 11:00am
0
```

The `distribution` function gives you the fraction of time that the
`TimeSeries` is in each state.

```python
```pycon
>>> time_series.distribution(
>>> start=datetime(2042, 2, 1, 6, 0, 0), # 6:00am
>>> end=datetime(2042, 2, 1, 13, 0, 0) # 1:00pm
Expand All @@ -86,7 +86,7 @@ How many lights are on throughout the day? The merge function takes the
forty individual `TimeSeries` and efficiently merges them into one
`TimeSeries` where the each value is a list of all lights.

```python
```pycon
>>> trace_list = [... list of forty traces.TimeSeries ...]
>>> count = traces.TimeSeries.merge(trace_list, operation=sum)
```
Expand All @@ -99,7 +99,7 @@ We also applied a `sum` operation to the list of states to get the
How many lights are on in the building on average during business hours,
from 8am to 6pm?

```python
```pycon
>>> histogram = count.distribution(
>>> start=datetime(2042, 2, 1, 8, 0, 0), # 8:00am
>>> end=datetime(2042, 2, 1, 12 + 6, 0, 0) # 6:00pm
Expand All @@ -119,18 +119,18 @@ long as they can be ordered. The values can be anything.
For example, you can use a `TimeSeries` to keep track the contents of a
grocery basket by the number of minutes within a shopping trip.

```python
```pycon
>>> time_series = traces.TimeSeries()
>>> time_series[1.2] = {'broccoli'}
>>> time_series[1.7] = {'broccoli', 'apple'}
>>> time_series[2.2] = {'apple'} # puts broccoli back
>>> time_series[3.5] = {'apple', 'beets'} # mmm, beets
```

To 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#).

## More info

To 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#).

## Contributing

Contributions are welcome and greatly appreciated! Please visit our [guidelines](https://github.com/datascopeanalytics/traces/blob/master/CONTRIBUTING.md)
Expand Down

0 comments on commit 8f8b136

Please sign in to comment.