measureia 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- measureia-0.1.0/PKG-INFO +176 -0
- measureia-0.1.0/README.md +158 -0
- measureia-0.1.0/pyproject.toml +28 -0
- measureia-0.1.0/src/measureia/Sim_info.py +159 -0
- measureia-0.1.0/src/measureia/__init__.py +20 -0
- measureia-0.1.0/src/measureia/measure_IA.py +1074 -0
- measureia-0.1.0/src/measureia/measure_IA_base.py +841 -0
- measureia-0.1.0/src/measureia/measure_jackknife.py +1160 -0
- measureia-0.1.0/src/measureia/measure_m_box.py +850 -0
- measureia-0.1.0/src/measureia/measure_m_lightcone.py +367 -0
- measureia-0.1.0/src/measureia/measure_w_box.py +647 -0
- measureia-0.1.0/src/measureia/measure_w_lightcone.py +353 -0
- measureia-0.1.0/src/measureia/read_data.py +279 -0
- measureia-0.1.0/src/measureia/write_data.py +61 -0
measureia-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: measureia
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Measureing tool for intrinsic alignment correlation functions.
|
|
5
|
+
Author: Marloes van Heukelum
|
|
6
|
+
Author-email: Marloes van Heukelum <m.l.vanheukelum@uu.nl>
|
|
7
|
+
Requires-Dist: astropy~=6.1.0
|
|
8
|
+
Requires-Dist: h5py~=3.10.0
|
|
9
|
+
Requires-Dist: kmeans-radec
|
|
10
|
+
Requires-Dist: matplotlib~=3.10.6
|
|
11
|
+
Requires-Dist: numpy~=1.26.2
|
|
12
|
+
Requires-Dist: pathos~=0.3.1
|
|
13
|
+
Requires-Dist: pyccl~=3.2
|
|
14
|
+
Requires-Dist: scipy~=1.11.4
|
|
15
|
+
Requires-Dist: sympy~=1.12
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# MeasureIA - The tool for measuring intrinsic alignment correlation functions in hydrodynamic simulations
|
|
20
|
+
|
|
21
|
+
MeasureIA is a tool that can be used to easily measure intrinsic alignment correlation functions and clustering in simulation boxes.
|
|
22
|
+
It includes measurement of wg+, wgg and the multipole moment estimator introduced in Singh et al (2024).
|
|
23
|
+
The correlation functions are measured for simulations in cartesian coordinates with periodic boundary conditions.
|
|
24
|
+
[Lightcone version is coming up, see Roadmap.]
|
|
25
|
+
Furthermore, the jackknife method is used to estimate the covariance matrix.
|
|
26
|
+
Outputs are saved in hdf5 files.
|
|
27
|
+
|
|
28
|
+
[//]: # (This package was developed for [link to paper].)
|
|
29
|
+
|
|
30
|
+
#### WARNING: This package is still in a development phase and this is therefore a beta-version.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
This package is currently still in a development phase and therefore not pip-installable. However, this will be
|
|
35
|
+
available in the future. The beta-version of this package can be installed.
|
|
36
|
+
|
|
37
|
+
### Install beta-version
|
|
38
|
+
|
|
39
|
+
The easiest way to install MeasureIA and its dependencies is using uv.
|
|
40
|
+
|
|
41
|
+
First, install uv (see https://docs.astral.sh/uv/getting-started/installation/).
|
|
42
|
+
Then clone the repository using either option:
|
|
43
|
+
|
|
44
|
+
```angular2html
|
|
45
|
+
git clone git@github.com:MarloesvL/measure_IA.git
|
|
46
|
+
git clone https://github.com/MarloesvL/measure_IA.git
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Next, navigate into the directory in your terminal (using cd).
|
|
50
|
+
Then run the command:
|
|
51
|
+
|
|
52
|
+
```angular2html
|
|
53
|
+
uv sync
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
This will create a virtual environment with all the dependencies needed for this package.
|
|
57
|
+
Either activate the virtual environment created by uv, or run scripts directly using:
|
|
58
|
+
|
|
59
|
+
```angular2html
|
|
60
|
+
uv run [script_name].py
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### Installing without uv
|
|
64
|
+
|
|
65
|
+
If you do not want to use uv, you can also install dependencies the provided requirements.txt document.
|
|
66
|
+
Note that you need to also download the kmeans-radec repository (https://github.com/esheldon/kmeans_radec) in this case.
|
|
67
|
+
Also, make sure your Python version is compatible. This package has been set up to use Python 3.11.
|
|
68
|
+
Both the extra repository and the python version are handeled by uv automatically so please consider using this for
|
|
69
|
+
easy installation.
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
See the example script 'example_measure_IA_box.py' or the jupyter notebook 'example_measureIA_box.ipynb' in the
|
|
74
|
+
examples directory for short examples on how this package can be used.
|
|
75
|
+
Explanations on various input parameters are explained in the comments (and more fully in the docstrings of the methods
|
|
76
|
+
and classes).
|
|
77
|
+
Given the data dictionary in the correct format, the methods (with all optional parameters as their default)
|
|
78
|
+
can be called as follows:
|
|
79
|
+
|
|
80
|
+
```angular2html
|
|
81
|
+
MeasureIA_test = MeasureIABox(data=data_dict, output_file_name="./outfile_name.hdf5", boxsize=205.)
|
|
82
|
+
# measure wgg, wg+
|
|
83
|
+
MeasureIA_test.measure_xi_w(dataset_name=dataset_name, corr_type="both", num_jk=27)
|
|
84
|
+
# measure multipoles
|
|
85
|
+
MeasureIA_test.measure_xi_multipoles(dataset_name=dataset_name, corr_type="both", num_jk=27)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
It is advisable to check out all the optional inputs in the examples.
|
|
89
|
+
|
|
90
|
+
## Documentation
|
|
91
|
+
|
|
92
|
+
The documentation for this package is still under development (see roadmap). Currently, the methods meant for use and
|
|
93
|
+
the inits of all classes have docstrings that provide the information needed. Please feel free to contact me for any
|
|
94
|
+
additional questions.
|
|
95
|
+
|
|
96
|
+
## Output file structure
|
|
97
|
+
Your output file with your own input of [output_file_name, snapshot, dataset_name, num_jk] will have the following structure:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
[output_file_name]
|
|
101
|
+
└── Snapshot_[snapshot] Optional. If input [snapshot] is None, this group is omitted.
|
|
102
|
+
├── w_gg
|
|
103
|
+
│ ├── [dataset_name] w_gg values for each r_p bin
|
|
104
|
+
│ ├── [dataset_name]_rp r_p mean bin values
|
|
105
|
+
│ ├── [dataset_name]_mean_[num_jk] mean w_gg value of all jackknife realisations
|
|
106
|
+
│ ├── [dataset_name]_jackknife_cov_[num_jk] jackknife estimate of covariance matrix
|
|
107
|
+
│ ├── [dataset_name]_jackknife_[num_jk] sqrt of diagonal of covariance matrix (size of errorbars)
|
|
108
|
+
│ └── [dataset_name]_jk[num_jk] group containing all jackknife realisations for this dataset
|
|
109
|
+
│ ├── [dataset_name]_[i] jackknife realisations with i running from 0 to num_jk - 1
|
|
110
|
+
│ └── [dataset_name]_[i]_rp r_p bin values of each jackknife realisation
|
|
111
|
+
├── w_g_plus
|
|
112
|
+
│ ├── [dataset_name] w_g+ values for each r_p bin
|
|
113
|
+
│ ├── [dataset_name]_rp r_p mean bin values
|
|
114
|
+
│ ├── [dataset_name]_mean_[num_jk] mean w_g+ value of all jackknife realisations
|
|
115
|
+
│ ├── [dataset_name]_jackknife_cov_[num_jk] jackknife estimate of covariance matrix
|
|
116
|
+
│ ├── [dataset_name]_jackknife_[num_jk] sqrt of diagonal of covariance matrix (size of errorbars)
|
|
117
|
+
│ └── [dataset_name]_jk[num_jk] group containing all jackknife realisations for this dataset
|
|
118
|
+
│ ├── [dataset_name]_[i] jackknife realisations with i running from 0 to num_jk - 1
|
|
119
|
+
│ └── [dataset_name]_[i]_rp r_p bin values of each jackknife realisation
|
|
120
|
+
└── w
|
|
121
|
+
├── xi_gg
|
|
122
|
+
│ ├── [dataset_name] xi_gg grid in (r_p,pi)
|
|
123
|
+
│ ├── [dataset_name]_rp r_p mean bin values
|
|
124
|
+
│ ├── [dataset_name]_pi pi mean bin values
|
|
125
|
+
│ ├── [dataset_name]_RR_gg RR grid in (r_p,pi)
|
|
126
|
+
│ ├── [dataset_name]_DD DD grid in (r_p,pi) (pair counts)
|
|
127
|
+
│ └── [dataset_name]_jk[num_jk] group containing all jackknife realisations for this dataset
|
|
128
|
+
│ ├── [dataset_name]_[i] jackknife realisations with i running from 0 to num_jk - 1
|
|
129
|
+
│ └── [dataset_name]_[i]_[x] with x in [rp, pi, RR_gg, DD] as above
|
|
130
|
+
├── xi_g_plus
|
|
131
|
+
│ ├── [dataset_name] xi_g+ grid in (rp_,pi)
|
|
132
|
+
│ ├── [dataset_name]_rp r_p mean bin values
|
|
133
|
+
│ ├── [dataset_name]_pi pi mean bin values
|
|
134
|
+
│ ├── [dataset_name]_RR_g_plus RR grid in (r_p,pi)
|
|
135
|
+
│ ├── [dataset_name]_SplusD S+D grid in (r_p,pi)
|
|
136
|
+
│ └── [dataset_name]_jk[num_jk] group containing all jackknife realisations for this dataset
|
|
137
|
+
│ ├── [dataset_name]_[i] jackknife realisations with i running from 0 to num_jk - 1
|
|
138
|
+
│ └── [dataset_name]_[i]_[x] with x in [rp, pi, RR_g_plus, SplusD] as above
|
|
139
|
+
└── xi_g_cross
|
|
140
|
+
├── [dataset_name] xi_gx grid in (r_p,pi)
|
|
141
|
+
├── [dataset_name]_rp r_p mean bin values
|
|
142
|
+
├── [dataset_name]_pi pi mean bin values
|
|
143
|
+
├── [dataset_name]_RR_g_cross RR grid in (r_p,pi)
|
|
144
|
+
├── [dataset_name]_ScrossD SxD grid in (r_p,pi) (pair counts)
|
|
145
|
+
└── [dataset_name]_jk[num_jk] group containing all jackknife realisations for this dataset
|
|
146
|
+
├── [dataset_name]_[i] jackknife realisations with i running from 0 to num_jk - 1
|
|
147
|
+
└── [dataset_name]_[i]_[x] with x in [rp, pi, RR_g_cross, ScrossD] as above
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
If you choose to measure multipoles instead of wg+, all 'w' will be replaced by 'multipoles' - or both will appear, if you have measured both.
|
|
151
|
+
For the multipoles, all xi_g+, DD (etc) grids are in (r, mu_r), not in (r_p, pi) and the suffixes of the bin values are also replaced by '_r' and '_mu_r' accordingly.
|
|
152
|
+
In one file, multiple redshift (snapshot) measurements can be saved without being overwritten, as well as the jackknife
|
|
153
|
+
information for different numbers of jackknife realisations (num_jk) for the same dataset.
|
|
154
|
+
|
|
155
|
+
## Roadmap
|
|
156
|
+
|
|
157
|
+
Upcoming developments include adding docstrings for all (internal) methods; creating a documentation website; extending
|
|
158
|
+
the tests; validating the lightcone methods and adding the Landy-Salazy estimator for the lightcone code.
|
|
159
|
+
Once the lightcone code is sufficiently validated, multiprocessing methods will be added there too.
|
|
160
|
+
Further down the road, another speed update may be added for the box methods; along with more variability
|
|
161
|
+
in definitions (e.g. optional resposivity factor).
|
|
162
|
+
|
|
163
|
+
## Requests
|
|
164
|
+
|
|
165
|
+
### Bugs
|
|
166
|
+
|
|
167
|
+
If you find a bug, please report it in a GitHub issue.
|
|
168
|
+
|
|
169
|
+
### Features
|
|
170
|
+
|
|
171
|
+
If you would like a feature added, please create an issue with the request. Within the issue, we can discuss how best
|
|
172
|
+
to proceed and what the timeline will be. Pull requests that have not been discussed beforehand will not be accepted.
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# MeasureIA - The tool for measuring intrinsic alignment correlation functions in hydrodynamic simulations
|
|
2
|
+
|
|
3
|
+
MeasureIA is a tool that can be used to easily measure intrinsic alignment correlation functions and clustering in simulation boxes.
|
|
4
|
+
It includes measurement of wg+, wgg and the multipole moment estimator introduced in Singh et al (2024).
|
|
5
|
+
The correlation functions are measured for simulations in cartesian coordinates with periodic boundary conditions.
|
|
6
|
+
[Lightcone version is coming up, see Roadmap.]
|
|
7
|
+
Furthermore, the jackknife method is used to estimate the covariance matrix.
|
|
8
|
+
Outputs are saved in hdf5 files.
|
|
9
|
+
|
|
10
|
+
[//]: # (This package was developed for [link to paper].)
|
|
11
|
+
|
|
12
|
+
#### WARNING: This package is still in a development phase and this is therefore a beta-version.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
This package is currently still in a development phase and therefore not pip-installable. However, this will be
|
|
17
|
+
available in the future. The beta-version of this package can be installed.
|
|
18
|
+
|
|
19
|
+
### Install beta-version
|
|
20
|
+
|
|
21
|
+
The easiest way to install MeasureIA and its dependencies is using uv.
|
|
22
|
+
|
|
23
|
+
First, install uv (see https://docs.astral.sh/uv/getting-started/installation/).
|
|
24
|
+
Then clone the repository using either option:
|
|
25
|
+
|
|
26
|
+
```angular2html
|
|
27
|
+
git clone git@github.com:MarloesvL/measure_IA.git
|
|
28
|
+
git clone https://github.com/MarloesvL/measure_IA.git
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Next, navigate into the directory in your terminal (using cd).
|
|
32
|
+
Then run the command:
|
|
33
|
+
|
|
34
|
+
```angular2html
|
|
35
|
+
uv sync
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This will create a virtual environment with all the dependencies needed for this package.
|
|
39
|
+
Either activate the virtual environment created by uv, or run scripts directly using:
|
|
40
|
+
|
|
41
|
+
```angular2html
|
|
42
|
+
uv run [script_name].py
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### Installing without uv
|
|
46
|
+
|
|
47
|
+
If you do not want to use uv, you can also install dependencies the provided requirements.txt document.
|
|
48
|
+
Note that you need to also download the kmeans-radec repository (https://github.com/esheldon/kmeans_radec) in this case.
|
|
49
|
+
Also, make sure your Python version is compatible. This package has been set up to use Python 3.11.
|
|
50
|
+
Both the extra repository and the python version are handeled by uv automatically so please consider using this for
|
|
51
|
+
easy installation.
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
See the example script 'example_measure_IA_box.py' or the jupyter notebook 'example_measureIA_box.ipynb' in the
|
|
56
|
+
examples directory for short examples on how this package can be used.
|
|
57
|
+
Explanations on various input parameters are explained in the comments (and more fully in the docstrings of the methods
|
|
58
|
+
and classes).
|
|
59
|
+
Given the data dictionary in the correct format, the methods (with all optional parameters as their default)
|
|
60
|
+
can be called as follows:
|
|
61
|
+
|
|
62
|
+
```angular2html
|
|
63
|
+
MeasureIA_test = MeasureIABox(data=data_dict, output_file_name="./outfile_name.hdf5", boxsize=205.)
|
|
64
|
+
# measure wgg, wg+
|
|
65
|
+
MeasureIA_test.measure_xi_w(dataset_name=dataset_name, corr_type="both", num_jk=27)
|
|
66
|
+
# measure multipoles
|
|
67
|
+
MeasureIA_test.measure_xi_multipoles(dataset_name=dataset_name, corr_type="both", num_jk=27)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
It is advisable to check out all the optional inputs in the examples.
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
The documentation for this package is still under development (see roadmap). Currently, the methods meant for use and
|
|
75
|
+
the inits of all classes have docstrings that provide the information needed. Please feel free to contact me for any
|
|
76
|
+
additional questions.
|
|
77
|
+
|
|
78
|
+
## Output file structure
|
|
79
|
+
Your output file with your own input of [output_file_name, snapshot, dataset_name, num_jk] will have the following structure:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
[output_file_name]
|
|
83
|
+
└── Snapshot_[snapshot] Optional. If input [snapshot] is None, this group is omitted.
|
|
84
|
+
├── w_gg
|
|
85
|
+
│ ├── [dataset_name] w_gg values for each r_p bin
|
|
86
|
+
│ ├── [dataset_name]_rp r_p mean bin values
|
|
87
|
+
│ ├── [dataset_name]_mean_[num_jk] mean w_gg value of all jackknife realisations
|
|
88
|
+
│ ├── [dataset_name]_jackknife_cov_[num_jk] jackknife estimate of covariance matrix
|
|
89
|
+
│ ├── [dataset_name]_jackknife_[num_jk] sqrt of diagonal of covariance matrix (size of errorbars)
|
|
90
|
+
│ └── [dataset_name]_jk[num_jk] group containing all jackknife realisations for this dataset
|
|
91
|
+
│ ├── [dataset_name]_[i] jackknife realisations with i running from 0 to num_jk - 1
|
|
92
|
+
│ └── [dataset_name]_[i]_rp r_p bin values of each jackknife realisation
|
|
93
|
+
├── w_g_plus
|
|
94
|
+
│ ├── [dataset_name] w_g+ values for each r_p bin
|
|
95
|
+
│ ├── [dataset_name]_rp r_p mean bin values
|
|
96
|
+
│ ├── [dataset_name]_mean_[num_jk] mean w_g+ value of all jackknife realisations
|
|
97
|
+
│ ├── [dataset_name]_jackknife_cov_[num_jk] jackknife estimate of covariance matrix
|
|
98
|
+
│ ├── [dataset_name]_jackknife_[num_jk] sqrt of diagonal of covariance matrix (size of errorbars)
|
|
99
|
+
│ └── [dataset_name]_jk[num_jk] group containing all jackknife realisations for this dataset
|
|
100
|
+
│ ├── [dataset_name]_[i] jackknife realisations with i running from 0 to num_jk - 1
|
|
101
|
+
│ └── [dataset_name]_[i]_rp r_p bin values of each jackknife realisation
|
|
102
|
+
└── w
|
|
103
|
+
├── xi_gg
|
|
104
|
+
│ ├── [dataset_name] xi_gg grid in (r_p,pi)
|
|
105
|
+
│ ├── [dataset_name]_rp r_p mean bin values
|
|
106
|
+
│ ├── [dataset_name]_pi pi mean bin values
|
|
107
|
+
│ ├── [dataset_name]_RR_gg RR grid in (r_p,pi)
|
|
108
|
+
│ ├── [dataset_name]_DD DD grid in (r_p,pi) (pair counts)
|
|
109
|
+
│ └── [dataset_name]_jk[num_jk] group containing all jackknife realisations for this dataset
|
|
110
|
+
│ ├── [dataset_name]_[i] jackknife realisations with i running from 0 to num_jk - 1
|
|
111
|
+
│ └── [dataset_name]_[i]_[x] with x in [rp, pi, RR_gg, DD] as above
|
|
112
|
+
├── xi_g_plus
|
|
113
|
+
│ ├── [dataset_name] xi_g+ grid in (rp_,pi)
|
|
114
|
+
│ ├── [dataset_name]_rp r_p mean bin values
|
|
115
|
+
│ ├── [dataset_name]_pi pi mean bin values
|
|
116
|
+
│ ├── [dataset_name]_RR_g_plus RR grid in (r_p,pi)
|
|
117
|
+
│ ├── [dataset_name]_SplusD S+D grid in (r_p,pi)
|
|
118
|
+
│ └── [dataset_name]_jk[num_jk] group containing all jackknife realisations for this dataset
|
|
119
|
+
│ ├── [dataset_name]_[i] jackknife realisations with i running from 0 to num_jk - 1
|
|
120
|
+
│ └── [dataset_name]_[i]_[x] with x in [rp, pi, RR_g_plus, SplusD] as above
|
|
121
|
+
└── xi_g_cross
|
|
122
|
+
├── [dataset_name] xi_gx grid in (r_p,pi)
|
|
123
|
+
├── [dataset_name]_rp r_p mean bin values
|
|
124
|
+
├── [dataset_name]_pi pi mean bin values
|
|
125
|
+
├── [dataset_name]_RR_g_cross RR grid in (r_p,pi)
|
|
126
|
+
├── [dataset_name]_ScrossD SxD grid in (r_p,pi) (pair counts)
|
|
127
|
+
└── [dataset_name]_jk[num_jk] group containing all jackknife realisations for this dataset
|
|
128
|
+
├── [dataset_name]_[i] jackknife realisations with i running from 0 to num_jk - 1
|
|
129
|
+
└── [dataset_name]_[i]_[x] with x in [rp, pi, RR_g_cross, ScrossD] as above
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
If you choose to measure multipoles instead of wg+, all 'w' will be replaced by 'multipoles' - or both will appear, if you have measured both.
|
|
133
|
+
For the multipoles, all xi_g+, DD (etc) grids are in (r, mu_r), not in (r_p, pi) and the suffixes of the bin values are also replaced by '_r' and '_mu_r' accordingly.
|
|
134
|
+
In one file, multiple redshift (snapshot) measurements can be saved without being overwritten, as well as the jackknife
|
|
135
|
+
information for different numbers of jackknife realisations (num_jk) for the same dataset.
|
|
136
|
+
|
|
137
|
+
## Roadmap
|
|
138
|
+
|
|
139
|
+
Upcoming developments include adding docstrings for all (internal) methods; creating a documentation website; extending
|
|
140
|
+
the tests; validating the lightcone methods and adding the Landy-Salazy estimator for the lightcone code.
|
|
141
|
+
Once the lightcone code is sufficiently validated, multiprocessing methods will be added there too.
|
|
142
|
+
Further down the road, another speed update may be added for the box methods; along with more variability
|
|
143
|
+
in definitions (e.g. optional resposivity factor).
|
|
144
|
+
|
|
145
|
+
## Requests
|
|
146
|
+
|
|
147
|
+
### Bugs
|
|
148
|
+
|
|
149
|
+
If you find a bug, please report it in a GitHub issue.
|
|
150
|
+
|
|
151
|
+
### Features
|
|
152
|
+
|
|
153
|
+
If you would like a feature added, please create an issue with the request. Within the issue, we can discuss how best
|
|
154
|
+
to proceed and what the timeline will be. Pull requests that have not been discussed beforehand will not be accepted.
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "measureia"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Measureing tool for intrinsic alignment correlation functions."
|
|
5
|
+
authors = [{ name = "Marloes van Heukelum", email = "m.l.vanheukelum@uu.nl" }]
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
requires-python = ">=3.10"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"astropy~=6.1.0",
|
|
10
|
+
"h5py~=3.10.0",
|
|
11
|
+
"kmeans-radec",
|
|
12
|
+
"matplotlib~=3.10.6",
|
|
13
|
+
"numpy~=1.26.2",
|
|
14
|
+
"pathos~=0.3.1",
|
|
15
|
+
"pyccl~=3.2",
|
|
16
|
+
"scipy~=1.11.4",
|
|
17
|
+
"sympy~=1.12",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[dependency-groups] # doc packages also in dev
|
|
21
|
+
dev = ["pytest~=8.3.1"]
|
|
22
|
+
|
|
23
|
+
[tool.uv.sources]
|
|
24
|
+
kmeans-radec = { git = "https://github.com/esheldon/kmeans_radec" }
|
|
25
|
+
|
|
26
|
+
[build-system]
|
|
27
|
+
requires = ["uv_build>=0.8.17,<0.9.0"]
|
|
28
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
class SimInfo:
|
|
2
|
+
"""Class that stores simulation information in an object to be inherited by other classes.
|
|
3
|
+
Simulation information is hard coded and therefore uses are limited. However, can easily be expanded.
|
|
4
|
+
Currently, these simulations are available: [TNG100, TNG100_2, TNG300, EAGLE, HorizonAGN, FLAMINGO_L1,
|
|
5
|
+
FLAMINGO_L2p8].
|
|
6
|
+
|
|
7
|
+
Attributes
|
|
8
|
+
----------
|
|
9
|
+
simname : str or NoneType
|
|
10
|
+
Identifier of the simulation, allowing for correct information to be obtained.
|
|
11
|
+
snapshot : int or str or NoneType
|
|
12
|
+
Number of the snapshot.
|
|
13
|
+
snap_group : str
|
|
14
|
+
Name of group in output file. Equal to 'Snapshot_[snapshot]' if snapshot is given, otherwise emtpy string.
|
|
15
|
+
boxsize : int or float, default=None
|
|
16
|
+
Size of simulation box. If simname is in SimInfo, units are cMpc/h. Otherwise, manual input.
|
|
17
|
+
L_0p5 : int or float, default=None
|
|
18
|
+
Half of the boxsize.
|
|
19
|
+
h : float, default=None
|
|
20
|
+
Value of cosmological h parameter, for easy access to convert units.
|
|
21
|
+
N_files : int, default=None
|
|
22
|
+
Number of files of snapshot or subhalo data. Used in ReadData class.
|
|
23
|
+
fof_folder : str, default=None
|
|
24
|
+
Name of folder where fof files are saved (only available for TNG).
|
|
25
|
+
snap_folder : str, default=None
|
|
26
|
+
Name of folder where snapshot files are saved.
|
|
27
|
+
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self, sim_name, snapshot, boxsize=None, h=None, file_info=False):
|
|
31
|
+
"""
|
|
32
|
+
The __init__ method of SimInfo class.
|
|
33
|
+
Creates all attributes and obtains information that is hardcoded in the class.
|
|
34
|
+
|
|
35
|
+
Parameters
|
|
36
|
+
----------
|
|
37
|
+
sim_name : str or NoneType
|
|
38
|
+
Identifier of the simulation, allowing for correct information to be obtained.
|
|
39
|
+
Choose from [TNG100, TNG100_2, TNG300, EAGLE, HorizonAGN, FLAMINGO_L1, FLAMINGO_L2p8].
|
|
40
|
+
If None, no information will be returned that is not already given as input.
|
|
41
|
+
snapshot : int or str or NoneType
|
|
42
|
+
Number of the snapshot, which, if given, will ensure that the output file to contains a group
|
|
43
|
+
'Snapshot_[snapshot]'. If None, the group is omitted from the output file structure. Default is None.
|
|
44
|
+
boxsize : int or float, default=None
|
|
45
|
+
Size of simulation box. Use if your simulation information is not provided by SimInfo.
|
|
46
|
+
Make sure that the boxsize is in the same units as your position coordinates.
|
|
47
|
+
h : float, default=None
|
|
48
|
+
Value of cosmological h parameter, for easy access to convert units.
|
|
49
|
+
file_info : bool, default=False
|
|
50
|
+
If True, calls get_file_info method
|
|
51
|
+
|
|
52
|
+
"""
|
|
53
|
+
self.simname = sim_name
|
|
54
|
+
self.N_files = None
|
|
55
|
+
self.fof_folder = None
|
|
56
|
+
self.snap_folder = None
|
|
57
|
+
if snapshot is None:
|
|
58
|
+
self.snapshot = None
|
|
59
|
+
self.snap_group = ""
|
|
60
|
+
else:
|
|
61
|
+
self.snapshot = str(snapshot)
|
|
62
|
+
self.snap_group = f"Snapshot_{self.snapshot}/"
|
|
63
|
+
if type(sim_name) == str:
|
|
64
|
+
self.get_specs()
|
|
65
|
+
if file_info:
|
|
66
|
+
self.get_file_info()
|
|
67
|
+
else:
|
|
68
|
+
self.boxsize = boxsize
|
|
69
|
+
self.h = h
|
|
70
|
+
if boxsize is None:
|
|
71
|
+
self.L_0p5 = None
|
|
72
|
+
else:
|
|
73
|
+
self.L_0p5 = boxsize / 2.
|
|
74
|
+
return
|
|
75
|
+
|
|
76
|
+
def get_specs(self):
|
|
77
|
+
"""Obtains the boxsize, L_0p5 and h parameters that are stored for [TNG100, TNG100_2, TNG300, EAGLE, HorizonAGN,
|
|
78
|
+
FLAMINGO_L1, FLAMINGO_L2p8].
|
|
79
|
+
|
|
80
|
+
Raises
|
|
81
|
+
------
|
|
82
|
+
KeyError
|
|
83
|
+
If unknown simname is given.
|
|
84
|
+
|
|
85
|
+
"""
|
|
86
|
+
if self.simname == "TNG100":
|
|
87
|
+
self.boxsize = 75.0 # cMpc/h
|
|
88
|
+
self.L_0p5 = self.boxsize / 2.0
|
|
89
|
+
self.h = 0.6774
|
|
90
|
+
elif self.simname == "TNG100_2":
|
|
91
|
+
self.boxsize = 75.0 # cMpc/h
|
|
92
|
+
self.L_0p5 = self.boxsize / 2.0
|
|
93
|
+
self.h = 0.6774
|
|
94
|
+
elif self.simname == "TNG300":
|
|
95
|
+
self.boxsize = 205.0 # cMpc/h
|
|
96
|
+
self.L_0p5 = self.boxsize / 2.0
|
|
97
|
+
self.h = 0.6774
|
|
98
|
+
elif self.simname == "EAGLE":
|
|
99
|
+
self.boxsize = 100.0 * 0.6777 # cMpc/h
|
|
100
|
+
self.L_0p5 = self.boxsize / 2.0
|
|
101
|
+
self.h = 0.6777
|
|
102
|
+
elif self.simname == "HorizonAGN":
|
|
103
|
+
self.boxsize = 100.0 # cMpc/h
|
|
104
|
+
self.L_0p5 = self.boxsize / 2.0
|
|
105
|
+
self.h = 0.704
|
|
106
|
+
elif "FLAMINGO" in self.simname:
|
|
107
|
+
if "L1" in self.simname:
|
|
108
|
+
self.boxsize = 1000.0 * 0.681 # cMpc/h
|
|
109
|
+
elif "L2p8" in self.simname:
|
|
110
|
+
self.boxsize = 2800.0 * 0.681 # cMpc/h
|
|
111
|
+
else:
|
|
112
|
+
raise KeyError("Add an L1 or L2p8 suffix to your simname to specify which boxsize is used")
|
|
113
|
+
self.L_0p5 = self.boxsize / 2.0
|
|
114
|
+
self.h = 0.681
|
|
115
|
+
else:
|
|
116
|
+
raise KeyError(
|
|
117
|
+
"Simulation name not recognised. Choose from [TNG100, TNG100_2, TNG300, EAGLE, HorizonAGN, FLAMINGO_L1, "
|
|
118
|
+
"FLAMINGO_L2p8].")
|
|
119
|
+
return
|
|
120
|
+
|
|
121
|
+
def get_file_info(self):
|
|
122
|
+
"""Creates N_files, fof_folder and snap_folder attributed needed by ReadData class.
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
if self.simname == "TNG100":
|
|
126
|
+
self.fof_folder = f"/fof_subhalo_tab_0{self.snapshot}/fof_subhalo_tab_0{self.snapshot}"
|
|
127
|
+
self.snap_folder = f"/snap_0{self.snapshot}/snap_0{self.snapshot}"
|
|
128
|
+
self.N_files = 448
|
|
129
|
+
elif self.simname == "TNG100_2":
|
|
130
|
+
self.fof_folder = f"/fof_subhalo_tab_0{self.snapshot}/fof_subhalo_tab_0{self.snapshot}"
|
|
131
|
+
self.snap_folder = f"/snap_0{self.snapshot}/snap_0{self.snapshot}"
|
|
132
|
+
self.N_files = 56
|
|
133
|
+
elif self.simname == "TNG300":
|
|
134
|
+
self.fof_folder = f"/fof_subhalo_tab_0{self.snapshot}/fof_subhalo_tab_0{self.snapshot}"
|
|
135
|
+
self.snap_folder = f"/snap_0{self.snapshot}/snap_0{self.snapshot}"
|
|
136
|
+
self.N_files = 600
|
|
137
|
+
elif self.simname == "EAGLE":
|
|
138
|
+
znames = {"28": "z000p000", "17": "z001p487", "19": "z001p004", "21": "z000p736", "23": "z000p503",
|
|
139
|
+
"25": "z000p271"}
|
|
140
|
+
zname = znames[self.snapshot]
|
|
141
|
+
self.snap_folder = f"/snap_0{self.snapshot}/RefL0100N1504/snapshot_0{self.snapshot}_{zname}/snap_0{self.snapshot}_{zname}" # update for different z?
|
|
142
|
+
self.fof_folder = None
|
|
143
|
+
self.N_files = 256
|
|
144
|
+
elif self.simname == "HorizonAGN":
|
|
145
|
+
self.fof_folder = None
|
|
146
|
+
self.snap_folder = None
|
|
147
|
+
self.N_files = 1.
|
|
148
|
+
elif "FLAMINGO" in self.simname:
|
|
149
|
+
self.fof_folder = None
|
|
150
|
+
self.snap_folder = None
|
|
151
|
+
self.N_files = 1
|
|
152
|
+
else:
|
|
153
|
+
raise KeyError(
|
|
154
|
+
"Simulation name not recognised. Choose from [TNG100, TNG300, EAGLE, HorizonAGN, FLAMINGO_L1_m8, FLAMINGO_L1_m9, FLAMINGO_L1_m10, FLAMINGO_L2p8_m9].")
|
|
155
|
+
return
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
if __name__ == "__main__":
|
|
159
|
+
pass
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# import internal classes for use, so the module file names do not need to be called.
|
|
2
|
+
|
|
3
|
+
# import base and wrapper classes
|
|
4
|
+
from .measure_IA import MeasureIABox
|
|
5
|
+
from .measure_IA import MeasureIALightcone
|
|
6
|
+
from .measure_IA_base import MeasureIABase
|
|
7
|
+
|
|
8
|
+
# import covariance measurement class
|
|
9
|
+
from .measure_jackknife import MeasureJackknife
|
|
10
|
+
|
|
11
|
+
# import backend method classes used in MeasureIA
|
|
12
|
+
from .measure_w_box import MeasureWBox
|
|
13
|
+
from .measure_m_box import MeasureMultipolesBox
|
|
14
|
+
from .measure_w_lightcone import MeasureWLightcone
|
|
15
|
+
from .measure_m_lightcone import MeasureMultipolesLightcone
|
|
16
|
+
|
|
17
|
+
# import utilities
|
|
18
|
+
from .read_data import ReadData
|
|
19
|
+
from .Sim_info import SimInfo
|
|
20
|
+
from .write_data import create_group_hdf5, write_dataset_hdf5
|