Skip to content

Commit

Permalink
rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
nonnontrivial committed May 2, 2024
1 parent fe3e5f8 commit 413d9dd
Show file tree
Hide file tree
Showing 54 changed files with 292,862 additions and 69 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ __pycache__/
data/globe_at_night/*.csv

prediction/*.csv
validation/*.csv
2 changes: 2 additions & 0 deletions .idea/ctts.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 0 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +0,0 @@
# CTTS

APIs that tap into the quality of the night sky.

## Building and training the sky brightness model

> Note that `globe_at_night.tar.gz` will need to unpacked into `./data/globe_at_night`
- `python -m ctts.model.build` to write the csv that the model trains on
- `python -m ctts.model.train` to train on the data in the csv

## HTTP APIs

### how to run locally

> Note: tested on python 3.11
```sh
pip install -r requirements.txt
python -m uvicorn ctts.api:app --reload
```

- artificial sky brightness (light pollution)
- predictive sky brightness

### endpoints

#### `/api/v1/pollution`

Gets the approximate artificial sky brightness
map [RGBA pixel value](https://djlorenz.github.io/astronomy/lp2022/colors.html) for a lat and lon (for the year 2022).

```sh
curl "localhost:8000/api/v1/pollution?lat=40.7277478&lon=-74.0000374"
```

```json
{
"r": 255,
"g": 255,
"b": 255,
"a": 255
}
```

#### `/api/v1/prediction`

Gets the predicted sky brightness at `lat` and `lon` for the current time.

```sh
curl "http://localhost:8000/api/v1/prediction?lat=-30.2466&lon=-70.7494"

```

```json
{
"sky_brightness": 22.0388
}
```

### swagger ui

Open the [ui](http://localhost:8000/docs) in a browser.

File renamed without changes.
3 changes: 3 additions & 0 deletions api/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions api/.idea/api.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/.idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions api/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions api/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
62 changes: 62 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# api

## Building and training the sky brightness model

> Note that `globe_at_night.tar.gz` will need to unpacked into `./data/globe_at_night`
- `python -m ctts.model.build` to write the csv that the model trains on
- `python -m ctts.model.train` to train on the data in the csv

## HTTP APIs

### how to run locally

> Note: tested on python 3.11
```sh
pip install -r requirements.txt
python -m uvicorn ctts.api:app --reload
```

- artificial sky brightness (light pollution)
- predictive sky brightness

### endpoints

#### `/api/v1/pollution`

Gets the approximate artificial sky brightness
map [RGBA pixel value](https://djlorenz.github.io/astronomy/lp2022/colors.html) for a lat and lon (for the year 2022).

```sh
curl "localhost:8000/api/v1/pollution?lat=40.7277478&lon=-74.0000374"
```

```json
{
"r": 255,
"g": 255,
"b": 255,
"a": 255
}
```

#### `/api/v1/prediction`

Gets the predicted sky brightness at `lat` and `lon` for the current time.

```sh
curl "http://localhost:8000/api/v1/prediction?lat=-30.2466&lon=-70.7494"

```

```json
{
"sky_brightness": 22.0388
}
```

### swagger ui

Open the [ui](http://localhost:8000/docs) in a browser.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 413d9dd

Please sign in to comment.