Skip to content

Commit 94dbae6

Browse files
committed
Merge branch 'main' into module/power_spectrum
2 parents ab189c9 + 71fd1a4 commit 94dbae6

20 files changed

+536
-45
lines changed

.github/workflows/compatibility.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
os: [ubuntu-latest]
12-
python: ['3.10']
13-
toxenv: [py310-test, py310-test-dev]
12+
python: ['3.11']
13+
toxenv: [py311-test, py311-test-dev]
1414
release: [main, latest]
1515
steps:
1616
- name: Checkout Repository

.github/workflows/tests.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919

2020
- name: latest supported versions
2121
os: ubuntu-latest
22-
python: '3.10'
23-
toxenv: py310-test-all-latest-cov
22+
python: '3.11'
23+
toxenv: py311-test-all-latest-cov
2424
toxposargs: --cov-report=xml:${GITHUB_WORKSPACE}/coverage.xml
2525

2626
- name: oldest supported versions
@@ -30,13 +30,13 @@ jobs:
3030

3131
- name: macOS latest supported
3232
os: macos-latest
33-
python: '3.10'
34-
toxenv: py310-test-latest
33+
python: '3.11'
34+
toxenv: py311-test-latest
3535

3636
- name: Windows latest supported
3737
os: windows-latest
38-
python: '3.10'
39-
toxenv: py310-test-latest
38+
python: '3.11'
39+
toxenv: py311-test-latest
4040

4141
steps:
4242
- name: Checkout Repository

.zenodo.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
"affiliation": "University of Manchester",
4444
"name": "Juan Pablo Cordero"
4545
},
46+
{
47+
"orcid": "0000-0003-1560-7959",
48+
"affiliation": "University of Portsmouth",
49+
"name": "Fox Davidson"
50+
},
4651
{
4752
"orcid": "0000-0002-8218-563X",
4853
"affiliation": "University of Portsmouth",

CONTRIBUTING.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,45 @@
11
Contributor Guidelines
22
======================
33

4+
How to contribute
5+
-----------------
6+
We love contributions! SkyPy is open source,
7+
built on open source, and we'd love to have you hang out in our community.
8+
Whether you would like to contribute to SkyPy with your own piece of code or
9+
helping develop a concrete feature in SkyPy:
10+
11+
1. Read through our `Discussions Page`_ to start a new conversation and share your
12+
ideas or follow up an existing conversation on a particular feature.
13+
14+
2. Following the discussions, when you have a good idea of the specifics
15+
of the feature you wish to contribute, open an `Issue`_ describing the feature.
16+
17+
3. Then follow the `Contributor Guidelines`_ on the rest of this page to open
18+
a `Pull Request`_ to contribute the code implementing the new feature.
19+
20+
Members vs External contributions
21+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22+
23+
SkyPy allows contributions from two types of contributor: *Members* and *External Contributors*.
24+
These two categories are intended to allow contributions both from those who are willing and
25+
able to commit to being part of the SkyPy community and actively involved in the steering of the project,
26+
and those who wish to simply contribute code where a need has been identified.
27+
28+
1. SkyPy *Members* go through a simple onboarding process where their expertise and expected contributions
29+
are discussed and defined. Members have access to internal communication channels, they are involved in
30+
SkyPy decision making processes and attend quarterly meetings.
31+
Members are listed as a separate tier in author lists for SkyPy publications,
32+
with the classification of "Creators" in the Zenodo DoI.
33+
34+
2. *External Contributors* are able to develop, discuss and commit code in the same way as *Members*,
35+
but do not have the same responsibilities and opportunities for contributing to the guidance and management
36+
of SkyPy as a project. *External Contributors* are listed as a separate tier in author lists for SkyPy publications,
37+
with the classification of "Others" in the Zenodo DoI.
38+
39+
.. _Discussions Page: https://github.com/skypyproject/skypy/discussions
40+
.. _Issue: https://github.com/skypyproject/skypy/issues
41+
.. _Pull Request: https://github.com/skypyproject/skypy/pulls
42+
443
GitHub Workflow
544
---------------
645

README.rst

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,66 @@ Examples_ that demonstrate how to use it.
6363
.. _Examples: https://skypy.readthedocs.io/en/stable/examples/index.html
6464

6565

66-
Get in Touch
66+
Contributing
6767
------------
6868

69-
You are welcome to talk about the SkyPy package and code using our
70-
`Discussions Page`_. For any other questions about the project in general,
71-
please get in touch with the `SkyPy Co-ordinators`_.
69+
We love contributions!
70+
SkyPy is open source,
71+
built on open source, and we'd love to have you hang out in our community.
7272

73-
.. _Discussions Page: https://github.com/skypyproject/skypy/discussions
74-
.. _SkyPy Co-ordinators: mailto:skypy-coordinators@googlegroups.com
73+
How to contribute
74+
^^^^^^^^^^^^^^^^^
7575

76-
Contributing
77-
------------
76+
Whether you would like to contribute to SkyPy with your own piece of code or
77+
helping develop a concrete feature in SkyPy:
7878

79-
We love contributions! SkyPy is open source,
80-
built on open source, and we'd love to have you hang out in our community.
81-
For information on how to contribute see our `Contributor Guidelines`_.
79+
1. Read through our `Discussions Page`_ to start a new conversation and share your
80+
ideas or follow up an existing conversation on a particular feature.
81+
82+
2. Following the discussions, when you have a good idea of the specifics
83+
of the feature you wish to contribute, open an `Issue`_ describing the feature.
84+
85+
3. Then follow the `Contributor Guidelines`_ to open a `Pull Request`_ to contribute
86+
the code implementing the new feature.
87+
88+
For further information on how to contribute see our `Contributor Guidelines`_.
8289
All communication relating to The SkyPy Project must meet the standards set out
8390
in the `Code of Conduct`_.
8491

92+
.. _Issue: https://github.com/skypyproject/skypy/issues
93+
.. _Pull Request: https://github.com/skypyproject/skypy/pulls
8594
.. _Contributor Guidelines: https://skypy.readthedocs.io/en/latest/developer/contributing.html
8695
.. _Code of Conduct: https://skypy.readthedocs.io/en/stable/project/code_of_conduct.html
8796

97+
Members vs External contributions
98+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
99+
100+
SkyPy allows contributions from two types of contributor: *Members* and *External Contributors*.
101+
These two categories are intended to allow contributions both from those who are willing and
102+
able to commit to being part of the SkyPy community and actively involved in the steering of the project,
103+
and those who wish to simply contribute code where a need has been identified.
104+
105+
1. SkyPy *Members* go through a simple onboarding process where their expertise and expected contributions
106+
are discussed and defined. Members have access to internal communication channels, they are involved in
107+
SkyPy decision making processes and attend quarterly meetings.
108+
Members are listed as a separate tier in author lists for SkyPy publications,
109+
with the classification of "Project Members" in the Zenodo DoI.
110+
111+
2. *External Contributors* are able to develop, discuss and commit code in the same way as *Members*,
112+
but do not have the same responsibilities and opportunities for contributing to the guidance and management
113+
of SkyPy as a project. *External Contributors* are listed as a separate tier in author lists for SkyPy publications,
114+
with the classification of "Others" in the Zenodo version DoI.
115+
116+
Get in Touch
117+
------------
118+
119+
You are welcome to talk about the SkyPy package and code using our
120+
`Discussions Page`_. For any other questions about the project in general,
121+
please get in touch with the `SkyPy Co-ordinators`_.
122+
123+
.. _Discussions Page: https://github.com/skypyproject/skypy/discussions
124+
.. _SkyPy Co-ordinators: mailto:skypy-coordinators@googlegroups.com
125+
88126
.. |PyPI| image:: https://img.shields.io/pypi/v/skypy?label=PyPI&logo=pypi
89127
:target: https://pypi.python.org/pypi/skypy
90128

docs/galaxies.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ The following models are found in the `skypy.galaxies.stellar_mass` package.
9191
schechter_smf_mass
9292

9393

94+
Velocity dispersion
95+
-------------------
96+
97+
The following models are found in the `skypy.galaxies.velocity_dispersion` package.
98+
99+
.. currentmodule:: skypy.galaxies.velocity_dispersion
100+
.. autosummary::
101+
:nosignatures:
102+
103+
schechter_vdf
104+
105+
94106
Reference/API
95107
=============
96108

@@ -103,3 +115,4 @@ Reference/API
103115
.. automodapi:: skypy.galaxies.spectrum
104116
:include-all-objects:
105117
.. automodapi:: skypy.galaxies.stellar_mass
118+
.. automodapi:: skypy.galaxies.velocity_dispersion

docs/utils/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ create their own named `speclite.filters.FilterResponse`.
143143
luminosity_in_band
144144
mag_ab
145145
SpectrumTemplates
146+
magnitude_error_rykoff
147+
logistic_completeness_function
146148

147149

148150
Random sampling (`skypy.utils.random`)

skypy/galaxies/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55

66
__all__ = [
77
'schechter_lf',
8+
'schechter_smf',
89
]
910

1011
from . import luminosity # noqa F401,F403
1112
from . import morphology # noqa F401,F403
1213
from . import redshift # noqa F401,F403
1314
from . import spectrum # noqa F401,F403
1415
from . import stellar_mass # noqa F401,F403
16+
from . import velocity_dispersion # noqa F401,F403
1517

1618
from ._schechter import schechter_lf # noqa
1719
from ._schechter import schechter_smf # noqa

skypy/galaxies/spectrum.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,28 @@ def stellar_mass(self, coefficients, magnitudes, filter):
143143
Mt = self.absolute_magnitudes(coefficients, filter)
144144
return np.power(10, 0.4*(Mt-magnitudes))
145145

146+
def stellar_mass_remain(self, coefficients, magnitudes, filter):
147+
r'''Compute total surviving stellar mass from absolute magnitudes.
148+
149+
Parameters
150+
----------
151+
coefficients : (ng, nt) array_like
152+
Array of template coefficients.
153+
magnitudes : (ng,) array_like
154+
The magnitudes to match in the reference bandpass.
155+
filter : str
156+
A single reference bandpass filter specification for
157+
`~speclite.filters.load_filters`.
158+
159+
Returns
160+
-------
161+
stellar_mass : (ng,) array_like
162+
Total surviving stellar mass of each galaxy in template units.
163+
'''
164+
m = self.stellar_mass(coefficients, magnitudes, filter)
165+
m *= np.dot(coefficients, self.mremain)
166+
return m
167+
146168
def metallicity(self, coefficients):
147169
r'''Galaxy metallicities from kcorrect templates.
148170

skypy/galaxies/stellar_mass.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
import numpy as np
55

66
from ..utils.random import schechter
7+
from ..utils import dependent_argument
78

89

910
__all__ = [
1011
'schechter_smf_mass',
1112
]
1213

1314

15+
@dependent_argument('m_star', 'redshift')
16+
@dependent_argument('alpha', 'redshift')
1417
def schechter_smf_mass(redshift, alpha, m_star, m_min, m_max, size=None,
1518
resolution=1000):
1619
r""" Stellar masses following the Schechter mass function [1]_.
@@ -19,9 +22,10 @@ def schechter_smf_mass(redshift, alpha, m_star, m_min, m_max, size=None,
1922
----------
2023
redshift : array_like
2124
Galaxy redshifts for which to sample magnitudes.
22-
alpha : float
23-
The alpha parameter in the Schechter stellar mass function.
24-
m_star : (nm,) array-like
25+
alpha : float or function
26+
The alpha parameter in the Schechter stellar mass function. If function,
27+
it must return a scalar value.
28+
m_star : (nm,) array-like or function
2529
Characteristic stellar mass m_*.
2630
size: int, optional
2731
Output shape of stellar mass samples. If size is None and m_star

0 commit comments

Comments
 (0)