Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bold renaming of the code #131

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
}
],
"contributorsPerLine": 7,
"projectName": "galcheat",
"projectOwner": "aboucaud",
"projectName": "surveycodex",
"projectOwner": "LSSTDESC",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
pip install ".[dev]"
- name: Test the code demo
run: |
python -m galcheat
python -m surveycodex
- name: Test the console script
run: |
galcheat --refs
surveycodex --refs
- name: Test the scripts
run: |
for pyscript in scripts/*.py; do python ${pyscript}; done
Expand Down
26 changes: 13 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to `galcheat`
# Contributing to `surveycodex`

We appreciate that you want to contribute to `galcheat`. Your time is valuable, and your contribution means a lot.
We appreciate that you want to contribute to `surveycodex`. Your time is valuable, and your contribution means a lot.

## Important!

Expand All @@ -16,37 +16,37 @@ There are several ways to contribute, namely:
- Add, update or correct information through [pull-requests](#pull-requests)


**Showing support for** `galcheat`
**Showing support for** `surveycodex`

Don't have time to contribute? No worries, here are some other ways to show your support for `galcheat`:
Don't have time to contribute? No worries, here are some other ways to show your support for `surveycodex`:

- star the [project](https://github.com/aboucaud/galcheat) (creates visibility)
- star the [project](https://github.com/LSSTDESC/surveycodex) (creates visibility)
- mention it around

## Issues

To create an issue, go to https://github.com/aboucaud/galcheat/issues/new, provide it with a meaningful title and a description, as well as labels if appropriate.
To create an issue, go to https://github.com/LSSTDESC/surveycodex/issues/new, provide it with a meaningful title and a description, as well as labels if appropriate.

## Pull-requests

To add, update or correct information, the first step is to setup a development environment for `galcheat` and then create feature branches for a given [pull-request](https://github.com/aboucaud/galcheat/pulls).
To add, update or correct information, the first step is to setup a development environment for `surveycodex` and then create feature branches for a given [pull-request](https://github.com/LSSTDESC/surveycodex/pulls).

> Note that you will have to [fork the project](https://guides.github.com/activities/forking/) to contribute.

### Getting a development environment (do once)

- Clone the project
```sh
git clone https://github.com/aboucaud/galcheat
cd galcheat
git clone https://github.com/LSSTDESC/surveycodex
cd surveycodex
```
- Setup the virtual environment with the dev tools
```sh
python -m venv venv
source venv/bin/activate
python -m pip install -U pip
```
- Install `galcheat` with developer libs
- Install `surveycodex` with developer libs
```sh
pip install -e ".[dev]"
```
Expand All @@ -61,10 +61,10 @@ To add, update or correct information, the first step is to setup a development

### Create a fork (do once)

- [Fork the galcheat project](https://guides.github.com/activities/forking/)
- [Fork the surveycodex project](https://guides.github.com/activities/forking/)
- Add the fork to the list of remote servers
```sh
git remote add fork git@github.com:<your username>/galcheat.git
git remote add fork git@github.com:<your username>/surveycodex.git
```

### Code in a feature branch
Expand All @@ -88,4 +88,4 @@ To add, update or correct information, the first step is to setup a development
git push -u fork featbranch # the first time to set the target remote
git push # afterwards
```
6. Create [the pull-request](https://github.com/aboucaud/galcheat/pulls) and iterate from 3. until it is merged.
6. Create [the pull-request](https://github.com/LSSTDESC/surveycodex/pulls) and iterate from 3. until it is merged.
46 changes: 24 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[**Main documentation**](https://aboucaud.github.io/galcheat/) | [**Getting started**](#getting-started) | [**CLI**](#cli) | [**API**](#api) | [**Contributing**](#contributing) | [**License**](#license)

<br>
<img src="docs/images/galcheat_logo.png" alt="galcheat" height=200px>
</p>
<!-- <br>
<img src="docs/images/surveycodex_logo.png" alt="surveycodex" height=200px>
</p> -->

# SurveyCodex

[![Python package][gh-workflow-badge]][gh-workflow]
[![License][license-badge]](LICENSE)
Expand All @@ -11,12 +13,12 @@
[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

[gh-workflow]: https://github.com/aboucaud/galcheat/actions/workflows/python-package.yml
[gh-workflow-badge]: https://github.com/aboucaud/galcheat/actions/workflows/python-package.yml/badge.svg
[license-badge]: https://img.shields.io/github/license/aboucaud/galcheat?color=blue
[pyversion-badge]: https://img.shields.io/pypi/pyversions/galcheat?color=yellow&logo=pypi
[pypi-badge]: https://badge.fury.io/py/galcheat.svg
[pypi]: https://pypi.org/project/galcheat/
[gh-workflow]: https://github.com/LSSTDESC/surveycodex/actions/workflows/python-package.yml
[gh-workflow-badge]: https://github.com/LSSTDESC/surveycodex/actions/workflows/python-package.yml/badge.svg
[license-badge]: https://img.shields.io/github/license/LSSTDESC/surveycodex?color=blue
[pyversion-badge]: https://img.shields.io/pypi/pyversions/surveycodex?color=yellow&logo=pypi
[pypi-badge]: https://badge.fury.io/py/surveycodex.svg
[pypi]: https://pypi.org/project/surveycodex/

Tiny package containing useful parameters from main galaxy surveys (**with units**).

Expand All @@ -28,7 +30,7 @@ Getting started
---------------
Install the latest version of the library
```sh
pip install -U galcheat
pip install -U surveycodex
```

CLI
Expand All @@ -37,7 +39,7 @@ CLI
Print the available surveys and associated filters

```sh
galcheat
surveycodex
```

### Options
Expand All @@ -48,22 +50,22 @@ galcheat

### Examples
```sh
galcheat -s LSST # LSST info
galcheat --refs # all surveys info with refs
galcheat --refs -s HSC # HSC info with refs
galcheat -s LSST --rich # pretty print rich terminal output for LSST info
surveycodex -s LSST # LSST info
surveycodex --refs # all surveys info with refs
surveycodex --refs -s HSC # HSC info with refs
surveycodex -s LSST --rich # pretty print rich terminal output for LSST info
```

API
---
```python
import galcheat
import surveycodex

# Start with the list of available surveys
galcheat.available_surveys
surveycodex.available_surveys

# Retrieve a Survey instance
LSST = galcheat.get_survey("LSST")
LSST = surveycodex.get_survey("LSST")

# List the available survey filters
LSST.available_filters
Expand All @@ -90,10 +92,10 @@ This project was started in the context of the [BlendingToolKit (BTK)][github-bt
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://aboucaud.github.io"><img src="https://avatars.githubusercontent.com/u/3065310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alexandre Boucaud</b></sub></a><br /><a href="https://github.com/aboucaud/galcheat/commits?author=aboucaud" title="Code">💻</a> <a href="#ideas-aboucaud" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-aboucaud" title="Maintenance">🚧</a> <a href="https://github.com/aboucaud/galcheat/pulls?q=is%3Apr+reviewed-by%3Aaboucaud" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://github.com/mpaillassa"><img src="https://avatars.githubusercontent.com/u/9745094?v=4?s=100" width="100px;" alt=""/><br /><sub><b>mpaillassa</b></sub></a><br /><a href="https://github.com/aboucaud/galcheat/commits?author=mpaillassa" title="Code">💻</a> <a href="https://github.com/aboucaud/galcheat/pulls?q=is%3Apr+reviewed-by%3Ampaillassa" title="Reviewed Pull Requests">👀</a> <a href="#data-mpaillassa" title="Data">🔣</a></td>
<td align="center"><a href="https://ismael-mendoza.github.io/"><img src="https://avatars.githubusercontent.com/u/11745764?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ismael Mendoza</b></sub></a><br /><a href="#ideas-ismael-mendoza" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/aboucaud/galcheat/pulls?q=is%3Apr+reviewed-by%3Aismael-mendoza" title="Reviewed Pull Requests">👀</a> <a href="#data-ismael-mendoza" title="Data">🔣</a></td>
<td align="center"><a href="https://github.com/HironaoMiyatake"><img src="https://avatars.githubusercontent.com/u/1507529?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hironao Miyatake</b></sub></a><br /><a href="https://github.com/aboucaud/galcheat/commits?author=HironaoMiyatake" title="Code">💻</a> <a href="#data-HironaoMiyatake" title="Data">🔣</a></td>
<td align="center"><a href="https://aboucaud.github.io"><img src="https://avatars.githubusercontent.com/u/3065310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alexandre Boucaud</b></sub></a><br /><a href="https://github.com/LSSTDESC/surveycodex/commits?author=aboucaud" title="Code">💻</a> <a href="#ideas-aboucaud" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-aboucaud" title="Maintenance">🚧</a> <a href="https://github.com/LSSTDESC/surveycodex/pulls?q=is%3Apr+reviewed-by%3ALSSTDESC" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://github.com/mpaillassa"><img src="https://avatars.githubusercontent.com/u/9745094?v=4?s=100" width="100px;" alt=""/><br /><sub><b>mpaillassa</b></sub></a><br /><a href="https://github.com/LSSTDESC/surveycodex/commits?author=mpaillassa" title="Code">💻</a> <a href="https://github.com/LSSTDESC/surveycodex/pulls?q=is%3Apr+reviewed-by%3Ampaillassa" title="Reviewed Pull Requests">👀</a> <a href="#data-mpaillassa" title="Data">🔣</a></td>
<td align="center"><a href="https://ismael-mendoza.github.io/"><img src="https://avatars.githubusercontent.com/u/11745764?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ismael Mendoza</b></sub></a><br /><a href="#ideas-ismael-mendoza" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/LSSTDESC/surveycodex/pulls?q=is%3Apr+reviewed-by%3Aismael-mendoza" title="Reviewed Pull Requests">👀</a> <a href="#data-ismael-mendoza" title="Data">🔣</a></td>
<td align="center"><a href="https://github.com/HironaoMiyatake"><img src="https://avatars.githubusercontent.com/u/1507529?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hironao Miyatake</b></sub></a><br /><a href="https://github.com/LSSTDESC/surveycodex/commits?author=HironaoMiyatake" title="Code">💻</a> <a href="#data-HironaoMiyatake" title="Data">🔣</a></td>
<td align="center"><a href="https://github.com/aguinot"><img src="https://avatars.githubusercontent.com/u/39480528?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Axel Guinot</b></sub></a><br /><a href="#data-aguinot" title="Data">🔣</a></td>
<td align="center"><a href="https://github.com/thuiop"><img src="https://avatars.githubusercontent.com/u/1338337?v=4?s=100" width="100px;" alt=""/><br /><sub><b>thuiop</b></sub></a><br /><a href="#ideas-thuiop" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://remyjoseph.wordpress.com/"><img src="https://avatars.githubusercontent.com/u/16084926?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rémy Joseph</b></sub></a><br /><a href="#ideas-herjy" title="Ideas, Planning, & Feedback">🤔</a></td>
Expand Down
4 changes: 2 additions & 2 deletions docs/api/filter.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# galcheat.filter
# surveycodex.filter

::: galcheat.filter
::: surveycodex.filter
4 changes: 2 additions & 2 deletions docs/api/helpers.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# galcheat.helpers
# surveycodex.helpers

<!-- ::: galcheat.helpers -->
<!-- ::: surveycodex.helpers -->
4 changes: 2 additions & 2 deletions docs/api/survey.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# galcheat.survey
# surveycodex.survey

::: galcheat.survey
::: surveycodex.survey
4 changes: 2 additions & 2 deletions docs/api/utilities.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# galcheat.utilities
# surveycodex.utilities

::: galcheat.utilities
::: surveycodex.utilities
22 changes: 11 additions & 11 deletions docs/guides/create-galaxy.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
# Simulate a simple galaxy with galcheat and GalSim
# Simulate a simple galaxy with surveycodex and GalSim

In this tutorial, we will see how we can use the survey parameters in galcheat
In this tutorial, we will see how we can use the survey parameters in surveycodex
to create a simple elliptical galaxy with galsim. The galaxy will be convolved with
a optical+atmospheric component PSF, include background and noise, and use
the r-band filter of the LSST survey.

Please note that `galsim` is not a `galcheat` dependency, so it must be installed
Please note that `galsim` is not a `surveycodex` dependency, so it must be installed
separately to follow this guide. See [here](https://galsim-developers.github.io/GalSim/_build/html/install.html)
for `galsim` installation instructions.

To draw the image at the end of the tutorial, `matplotlib` will also need to be installed separately.

First, we import galsim and necessary functions from galcheat.
First, we import galsim and necessary functions from surveycodex.

```python
import galsim
import galcheat
from galcheat import get_survey
from galcheat import utilities
import surveycodex
from surveycodex import get_survey
from surveycodex import utilities
import matplotlib.pyplot as plt
import numpy as np
```

Then, we specify the survey and filter from galcheat we will use. Along with
Then, we specify the survey and filter from surveycodex we will use. Along with
galaxy parameters.

```python
# galcheat survey and filter.
# surveycodex survey and filter.
LSST = get_survey("LSST")
r_band = LSST.get_filter("r")

Expand All @@ -40,7 +40,7 @@ hlr = 1.2 # arcsecs
Now we create a galaxy model and shear it.

```python
# get flux from magnitude using galcheat for LSST r-band.
# get flux from magnitude using surveycodex for LSST r-band.
total_flux = mag2counts(mag, LSST, r_band)

# get only the value of flux in desired units.
Expand Down Expand Up @@ -83,7 +83,7 @@ conv_gal = galsim.Convolve(gal, psf)
Finally, we add noise and background:

```python
# retrieve the sky level using galcheat.
# retrieve the sky level using surveycodex.
sky_level = utilities.mean_sky_level(LSST, r_band).to_value('electron')

# add noise and background to image.
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

```python
# The list of available surveys
from galcheat import available_surveys
from surveycodex import available_surveys

# Getter methods to retrieve a Survey of a Filter dataclass
from galcheat import get_survey, get_filter
from surveycodex import get_survey, get_filter

LSST = get_survey("LSST")
u_band = get_filter("u", "LSST")
Expand Down
8 changes: 4 additions & 4 deletions docs/guides/heritage.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Extend galcheat objects
# Extend surveycodex objects

## Frozen dataclasses

The goal of galcheat is to provide a **sourced reference** for survey parameters. Therefore the `Survey` and `Filter` objects have been implemented as frozen dataclasses. This means that trying to modify the attributes of an instance of a `Survey` or a `Filter` will raise a `FrozenInstanceError`.
The goal of surveycodex is to provide a **sourced reference** for survey parameters. Therefore the `Survey` and `Filter` objects have been implemented as frozen dataclasses. This means that trying to modify the attributes of an instance of a `Survey` or a `Filter` will raise a `FrozenInstanceError`.

Nevertheless, one might possibly want to modify or extend the instances of the dataclasses found in galcheat for specific purposes. This can be achieved through inheritance.
Nevertheless, one might possibly want to modify or extend the instances of the dataclasses found in surveycodex for specific purposes. This can be achieved through inheritance.

## Inheritance

Expand All @@ -16,6 +16,6 @@ class ExtensibleSurvey(Survey):
self.__dict__[x] = val
```

The `ExtensibleSurvey` will behave just as the galcheat `Survey` and will be extendable or modifiable. This is also true for the `Filter` class.
The `ExtensibleSurvey` will behave just as the surveycodex `Survey` and will be extendable or modifiable. This is also true for the `Filter` class.

!!! warning "To be used at you own risk"
22 changes: 11 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Welcome to `galcheat`
# Welcome to `surveycodex`

`galcheat` is a tiny package containing useful parameters from main galaxy surveys (**with units**).
`surveycodex` is a tiny package containing useful parameters from main galaxy surveys (**with units**).

The goal of this project is to provide a Python library with minimal dependencies that centralises galaxy survey properties with adequate reference. Such information tends to be scattered in many places or is often copy/pasted without all of the relevant information like units or sources.

Expand All @@ -9,7 +9,7 @@ The goal of this project is to provide a Python library with minimal dependencie
Pretty print the available surveys and associated filters in the terminal

```bash
galcheat
surveycodex
```

### Options
Expand All @@ -22,16 +22,16 @@ galcheat
### Examples

```sh
galcheat -s LSST # LSST info
galcheat --refs # all surveys info with refs
galcheat --refs -s HSC # HSC info with refs
galcheat -s LSST --rich # pretty print rich terminal output for LSST survey info
surveycodex -s LSST # LSST info
surveycodex --refs # all surveys info with refs
surveycodex --refs -s HSC # HSC info with refs
surveycodex -s LSST --rich # pretty print rich terminal output for LSST survey info
```

## Installation

```sh
python -m pip install -U galcheat
python -m pip install -U surveycodex
```

## Optional installation
Expand All @@ -41,20 +41,20 @@ python -m pip install -U galcheat
To run the Python scripts from the `script` folder, use the extra install

```sh
python -m pip install -U galcheat[scripts]
python -m pip install -U surveycodex[scripts]
```

### Developers

The developer tools needed to perform tests and linting and compile the docs locally can be installed with

```sh
python -m pip install -U galcheat[dev]
python -m pip install -U surveycodex[dev]
```

### Rich display (new in v1.1)

For a better terminal experience, install the `rich` library and use it together with the `--rich` option from `galcheat`
For a better terminal experience, install the `rich` library and use it together with the `--rich` option from `surveycodex`

```sh
python -m pip install rich
Expand Down
Loading
Loading