semvec/pypi-packages huggingface dataset:
sfctools 1.1.9.4
Framework for stock-flow consistent agent-based modeling, being developed at the German Aerospace Center (DLR) for and in the scientific context of energy systems analysis, however, it is widely applicable in other scientific fields.
License: MIT
Requires Python: <=3.13,>=3.6
Keywords: stock-flow-consistent, agent-based, agent, macroeconomics, computational economics

# sfctools - A toolbox for stock-flow consistent, agent-based models

Sfctools is a lightweight and easy-to-use Python framework for agent-based macroeconomic, stock-flow consistent (ABM-SFC) modeling. It concentrates on agents in economics and helps you to construct agents, helps you to manage and document your model parameters, assures stock-flow consistency, and facilitates basic economic data structures (such as the balance sheet). For more documentation, see https://sfctools-framework.readthedocs.io/en/latest/.

## Installation

We recommend to install sfctools in a fresh Python 3.8 environment. For example, with conda, do

    conda create --name sfcenv python=3.8
    conda activate sfcenv
    conda install pip

Then, in a terminal of your choice, type:

    pip install sfctools

see https://pypi.org/project/sfctools/

You can also build the software wheel directly from the git repository using the commands 

    pip uninstall sfctools -y
    poetry build 
    pip install <filename of .whl file in dist/folder>

This command requires poetry. It will uninstall sfctools and install the specified version

## Usage with Graphical User Interface 'Attune'

Type

    python -m sfctools attune

to start the GUI.

## Usage inside Python

Try out this simple example:

```python
from sfctools import Agent, World 

class SomeAgent(Agent):
    def __init__(self, a):
        super().__init__()
        self.some_attribute = a

my_agent = SomeAgent(a='Hello')
your_agent = SomeAgent(a='World')

my_agents = World().get_agents_of_type("SomeAgent")
my_message = my_agents[0].some_attribute
your_message = my_agents[1].some_attribute

print("%s says %s, %s says %s" % (my_agent, my_message, your_agent, your_message))
```

The resulting output will be

```console 
SomeAgent__00001 says Hello, SomeAgent__00002 says World
```

## More Examples

Have a look at the [documentation page](https://sfctools-framework.readthedocs.io/en/latest/doc_api_examples/examples_framework.html) for more examples. 


## Cite this Software

You can cite the software as follows: 

Baldauf, T., (2023). sfctools - A toolbox for stock-flow consistent, agent-based models. Journal of Open Source Software, 8(87), 4980, https://doi.org/10.21105/joss.04980


You can cite the software repository as follows:

Thomas Baldauf. (2023). sfctools - A toolbox for stock-flow consistent, agent-based models (1.1.0.2b). Zenodo. https://doi.org/10.5281/zenodo.8118870


-----------------------------------

| Corresponding author: Thomas Baldauf, German Aerospace Center (DLR), Curiestr. 4 70563 Stuttgart | thomas.baldauf@dlr.de |
ucam-observe 0.2.2
Python library to aid consistent configuration of logging, metrics (future) and tracing (further in future). Packaging and wiring existing open tooling to work effortlessly on UIS DevOps managed cloud infrastructure.
License: MIT
Requires Python: <4.0.0,>=3.9.1

# Observability Python Library

Currently a POC in the Wilson team. Python library to aid consistent configuration of logging,
metrics (future) and tracing (further in future). Packaging and wiring existing open tooling
to work effortlessly on UIS DevOps managed cloud infrastructure.

## Install this module

```bash
pip install ucam-observe
```

## Usage

### Logging

NOTE: Currently only vanilla python is supported, not Django.

Usage is similar to using `structlog` directly with the function `get_structlog_logger` returning
an object compatible with that returned by `structlog`'s `get_logger` function. No further
configuration is needed.

```bash
logger = get_structlog_logger(__name__)

logger.info("some_event")

logger.info("some_other_event", foo=bar)
```

### Metrics and Tracing

`raise NotImplemented`


## Include Gunicorn structlog configuration in your project

### Adapt Gunicorn configuration
In the root of your project, create/amend a gunicorn.conf.py. Add the following code to the file.

```py
from ucam_observe.gunicorn import (  # noqa F401 used by gunicorn as magic variable
    logconfig_dict
)
```

**Be sure not to set any log config values via the CLI or config files.**

### Environment Configuration

#### Log Level

Set the `LOG_LEVEL` environment variable to control the logging level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL). This setting adjusts the verbosity of the log outputs:

```bash
export LOG_LEVEL=DEBUG
```

#### Console Logging

Set the `CONSOLE_LOGGING` environment variable to control whether logs should be output in a console-friendly format. Set it to `True` to use console-friendly formatting:

```bash
export CONSOLE_LOGGING=True
```

### Example Docker Compose Configuration

When using Docker Compose for local development, you can set the environment variables in your `docker-compose.yml` file:

```yaml
version: '3.8'
services:
  your_service:
    build: .
    environment:
      - LOG_LEVEL=DEBUG
      - CONSOLE_LOGGING=True
```

## Developer quickstart

Firstly, [install docker-compose](https://docs.docker.com/compose/install/).
Install poethepoet
```bash
pip install poethepoet
```
Then, most tasks can be performed via the poe command.

E.g.

```bash
# Build the containers
$ poe build
```

Run the follow command to see available commands:
```bash
$ poe
```

### Optional extras

NOTE: The Django optional extra is currently empty with a ticket open to add the required
functionality

This library includes optional extras, e.g. `ucam-observe[django]`. Some
tests will require these optional dependencies to pass. The following command
will install all optional dependencies.

```bash
$ poe install-all-extras
```

Some tests require the absence of dependencies and these are excluded by
default. See the tox.ini file for how these tests are run.
pysleep 0.2.0
A Python library for sleep pattern analysis, sleep metrics calculation, and comprehensive sleep stage statistics
License: MIT
Requires Python: >=3.10
Keywords: sleep, analysis, metrics, medical, research, health, sleep-stages, sleep-analysis, sleep-tracking, polysomnography

# pysleep

A Python library for sleep pattern analysis and sleep metrics calculation commonly used in medical and research fields.

## Installation

```bash
pip install pysleep
```

## Features

- Definition of sleep stages and events in the Python ecosystem
- Various sleep metrics used in medical field
- Sleep statistics calculation and analysis tools
- Comprehensive sleep stage calculator for 30+ metrics from epoch data
- Returns `None` for breathing fields (requires sensor data)
- Returns `None` for sleep_index (scoring not implemented)

## Sleep Stage Calculator

The `SleepStageCalculator` analyzes 30-second epoch sleep stage data to compute comprehensive sleep metrics including latencies, durations, ratios, and sleep quality indices.

### Quick Example

```python
from pysleep import SleepStageCalculator
from datetime import datetime

# Initialize calculator
calculator = SleepStageCalculator()

# Define session times
start_time = datetime(2024, 1, 1, 22, 0, 0)
end_time = datetime(2024, 1, 2, 6, 0, 0)

# Sleep stages (30-second epochs): 0=WAKE, 1=LIGHT, 2=DEEP, 3=REM
sleep_stages = [0, 0, 1, 1, 2, 2, 3, 3, 1, 1, 0, 1, 2, 3]  # ... more epochs

# Calculate metrics
stats = calculator.calculate(sleep_stages, start_time, end_time)

# Access results (returns SleepStat object)
print(f"Sleep efficiency: {stats.sleep_efficiency:.1%}")
print(f"Time in sleep: {stats.time_in_sleep}")
print(f"Sleep latency: {stats.sleep_latency}")
print(f"Sleep cycles: {stats.sleep_cycle}")
```

For detailed documentation on all available metrics and advanced usage, see the [Sleep Stage Calculator documentation](src/pysleep/calculator/README.md).

## License

This project is licensed under the MIT License - see the LICENSE file for details.