semvec/pypi-packages huggingface dataset:
taskbadger 1.7.0
The official Python SDK for Task Badger
Requires Python: >=3.9

# Task Badger Python Client

This is the official Python SDK for [Task Badger](https://taskbadger.net/).

For full documentation go to https://docs.taskbadger.net/python/.

![Integration Tests](https://github.com/taskbadger/taskbadger-python/actions/workflows/integration_tests.yml/badge.svg)

---

## Getting Started

### Install

```bash
pip install --upgrade taskbadger
```

### Client Usage

#### Configuration

```python
import taskbadger

taskbadger.init(
    organization_slug="my-org",
    project_slug="my-project",
    token="***"
)
```

#### Usage with Celery

```python
import taskbadger
from celery import Celery

app = Celery("tasks")

@app.task(bind=True, base=taskbadger.Task)
def my_task(self):
    task = self.taskbadger_task
    for i in range(1000):
        do_something(i)
        if i % 100 == 0:
            task.update(value=i, value_max=1000)
    task.success(value=1000)
```

#### API Example

```python
from taskbadger import Task, Action, EmailIntegration, WebhookIntegration

# create a new task with custom data and an action definition
task = Task.create(
    "task name",
    data={
        "custom": "data"
    },
    actions=[
        Action("*/10%,success,error", integration=EmailIntegration(to="me@example.com")),
        Action("cancelled", integration=WebhookIntegration(id="webhook:demo")),
    ]
)

# update the task status to 'processing' and set the value to 0
task.started()
try:
   for i in range(100):
      do_something(i)
      if i!= 0 and i % 10 == 0:
         # update the progress of the task
         task.update_progress(i)
except Exception as e:
    # record task errors
    task.error(data={
        "error": str(e)
    })
    raise

# record task success
task.success()
```

### CLI USage

#### Configuration

```shell
$ taskbadger configure

Organization slug: my-org
Project slug: project-x
API Key: XYZ.ABC

Config written to ~/.config/taskbadger/config
```

#### Usage Examples

The CLI `run` command executes your command whilst creating and updating a Task Badger task.

```shell
$ taskbadger run "demo task" --action error email to:me@test.com -- path/to/script.sh

Task created: https://taskbadger.net/public/tasks/xyz/
```
skysurvey 0.31.0
Simulating Transient in the sky and how to observe them
Requires Python: >=3.10
Keywords: astronomy, astrophysics

[![PyPI](https://img.shields.io/pypi/v/skysurvey.svg?style=flat-square)](https://pypi.python.org/pypi/skysurvey)
[![Documentation Status](https://readthedocs.org/projects/skysurvey/badge/?version=latest)](https://skysurvey.readthedocs.io/en/latest/?badge=latest)


# skysurvey 

Simulate transients within the sky

skysurvey relies on sncosmo for bandpass and lightcurve generations. (https://sncosmo.readthedocs.io/en/stable/)

**See documentation on [read the docs](https://skysurvey.readthedocs.io/en/latest/)**

# Install
```bash
pip install skysurvey
```
or 
```bash
git clone https://github.com/MickaelRigault/skysurvey.git
cd skysurvey
pip install .
```

# Quick Start
You need to create a `Target` and a `Survey` to then
simulate how your survey would observe your targets ; 
aka a `DataSet`. 

Here is a quick example:

## Step 1: targets (truth)
```python
import skysurvey
snia = skysurvey.SNeIa()
data = snia.draw(size=50_000, tstart=56_000, tstop=56_100, inplace=True) # see options
data.head(5) # also snia.data
```

## Step 2: Survey (pointing and observing conditions)
```python
import numpy as np
from skysurvey.tools import utils

size = 10_000

# footprint
from shapely import geometry
sq_footprint = geometry.box(-1, -1, +1, +1)

# Observing data
ra, dec = utils.random_radec(size=size, ra_range=[200,250], dec_range=[-20,10])

data = {}
data["ra"] = ra
data["dec"] = dec
data["gain"] = 1
data["zp"] = 30
data["skynoise"] = np.random.normal(size=size, loc=150, scale=20)
data["mjd"] = np.random.uniform(56_000-10, 56_100 + 10, size=size)
data["band"] = np.random.choice(["desg","desr","desi"], size=size)

# Build the survey
survey = skysurvey.Survey.from_pointings(data, footprint=sq_footprint)
survey.data
```

## Step 3: Dataset

And now let's build the dataset. The simulated lightcurves are in
dset.data, the input survey is stored in dset.survey, the input
targets is stored in dset.targets

```python
from skysurvey import dataset
dset = dataset.DataSet.from_targets_and_survey(snia, survey)
dset.data
```