cosmoglint 1.0.0__tar.gz → 1.0.1__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.
Files changed (23) hide show
  1. cosmoglint-1.0.1/PKG-INFO +131 -0
  2. cosmoglint-1.0.1/README_PYPI.md +94 -0
  3. cosmoglint-1.0.1/cosmoglint/__init__.py +1 -0
  4. cosmoglint-1.0.1/cosmoglint.egg-info/PKG-INFO +131 -0
  5. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint.egg-info/SOURCES.txt +1 -0
  6. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint.egg-info/requires.txt +0 -1
  7. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/pyproject.toml +2 -3
  8. cosmoglint-1.0.0/PKG-INFO +0 -164
  9. cosmoglint-1.0.0/cosmoglint/__init__.py +0 -1
  10. cosmoglint-1.0.0/cosmoglint.egg-info/PKG-INFO +0 -164
  11. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/LICENSE +0 -0
  12. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/README.md +0 -0
  13. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint/model/__init__.py +0 -0
  14. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint/model/transformer.py +0 -0
  15. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint/model/transformer_nf.py +0 -0
  16. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint/utils/ReadPinocchio5.py +0 -0
  17. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint/utils/__init__.py +0 -0
  18. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint/utils/cosmology_utils.py +0 -0
  19. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint/utils/generation_utils.py +0 -0
  20. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint/utils/io_utils.py +0 -0
  21. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint.egg-info/dependency_links.txt +0 -0
  22. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/cosmoglint.egg-info/top_level.txt +0 -0
  23. {cosmoglint-1.0.0 → cosmoglint-1.0.1}/setup.cfg +0 -0
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: cosmoglint
3
+ Version: 1.0.1
4
+ Summary: Transformer-based generative model for galaxies
5
+ Author: Kana Moriwaki
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Kana Moriwaki
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/knmoriwaki/cosmoglint
29
+ Requires-Python: >=3.9
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: numpy
33
+ Requires-Dist: tqdm
34
+ Requires-Dist: h5py
35
+ Requires-Dist: astropy
36
+ Dynamic: license-file
37
+
38
+ # CosmoGLINT: Cosmological Generative model for Line INtensity mapping with Transformer
39
+
40
+ Transformer-based models that generate galaxies.
41
+
42
+ ---
43
+
44
+ ## Installation
45
+
46
+ This package is available on PyPI.
47
+
48
+ ```bash
49
+ pip install cosmoglint
50
+ ```
51
+
52
+ This package requires PyTorch.
53
+ Please install PyTorch first following https://pytorch.org
54
+
55
+ ## Documentation & Source code
56
+
57
+ GitHub: https://github.com/knmoriwaki/cosmoglint
58
+
59
+ ## Basic usage
60
+
61
+ Load model:
62
+ ```python
63
+ import json
64
+ from cosmoglint.model.transformer import transformer_model
65
+
66
+ with open(f"args.json", "r") as f:
67
+ option = json.load(f, object_hook=lambda d: argparse.Namespace(**d))
68
+
69
+ model = transformer_model(option)
70
+ ```
71
+ with a json file (example):
72
+ ```json
73
+ {"model_name": "transformer1", "max_length": 50, "d_model": 128, "num_layers": 4, "num_heads": 8, "num_features_out": 100, "num_features_in": 4}
74
+ ```
75
+
76
+ Predict probability:
77
+ ```python
78
+ prob = model(context, x)
79
+ ```
80
+
81
+ Generate new galaxies:
82
+ ```python
83
+ generated, prob = model.generate(context, x, prob_threshold=1e-5)
84
+ ```
85
+
86
+ Input:
87
+ - `context`: a tensor of shape `(N, C_h)`, containing the properties of halo.
88
+ - `x`: a tensor of shape `(N, L, C_g)`, containing the properties of up to `L` galaxies for each of the `N` halos in the batch. Each feature vector of size `C_g` may include, for example, the halo mass, relative distance to the halo center, radial velocity, and tangential velocity. Input `None` to generate from scratch.
89
+ - `prob_threshold` (optional): when sampling, the probability below this threshold is set to zero.
90
+
91
+ Output:
92
+ - `prob`: a tensor of shape `(N, L, C_g, d)`. `prob[i,j,k,:]` is the probability distribution over `d` bins for the k-th parameter of the **(j+1)-th galaxy** in the sequence for the i-th batch element.
93
+ - `generated`: a tensor of shape `(N, L, C_g)`. `generated[i,j,k]` is the sampled values for each parameter of **(j+1)-th galaxy** in the sequence for the i-th batch element.
94
+
95
+ Shape:
96
+ - `N`: Batch size
97
+ - `L`: Sequence length
98
+ - `C_h`: Number of halo properties
99
+ - `C_g`: Number of galaxy properties predicted
100
+ - `d`: Number of bins for the probability distribution of each parameter
101
+
102
+ Options:
103
+ | Key | Description |
104
+ |------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
105
+ | **`model_name`** | Name or identifier for the model configuration (default: `"transformer1"`). Available options are:<br> - `"transformer1"`: halo is prepended to the sequence<br> - `"transformer2"`: halo and galaxy features are embedded together | |
106
+ | **`max_length`** | Maximum number of galaxies (sequence length) the model will process per halo.|
107
+ | **`d_model`** | Dimensionality of the internal feature space (i.e., size of the token embeddings and hidden layers in the transformer). |
108
+ | **`num_layers`** | Number of transformer decoder layers stacked in the model. |
109
+ | **`num_heads`** | Number of attention heads in the multi-head self-attention layers. |
110
+ | **`num_features_out`** | Total number of output bins for the probability distribution. |
111
+ | **`num_features_in`** | Number of features per galaxy (e.g., SFR, relative distance, radial/tangential velocity). |
112
+
113
+
114
+ ## Citation
115
+
116
+ If you use CosmoGLINT in your research, please cite [Moriwaki et al. 2025](https://arxiv.org/abs/2506.16843)
117
+
118
+ ```
119
+ @ARTICLE{CosmoGLINT,
120
+ title = {CosmoGLINT: Cosmological Generative Model for Line Intensity Mapping with Transformer},
121
+ author = {{Moriwaki}, Kana and {Jun}, Rui Lan and {Osato}, Ken and {Yoshida}, Naoki},
122
+ journal = {arXiv preprints},
123
+ year = 2025,
124
+ month = jun,
125
+ eid = {arXiv:2506.16843},
126
+ doi = {10.48550/arXiv.2506.16843},
127
+ archivePrefix = {arXiv},
128
+ eprint = {2506.16843},
129
+ primaryClass = {astro-ph.CO}
130
+ }
131
+ ```
@@ -0,0 +1,94 @@
1
+ # CosmoGLINT: Cosmological Generative model for Line INtensity mapping with Transformer
2
+
3
+ Transformer-based models that generate galaxies.
4
+
5
+ ---
6
+
7
+ ## Installation
8
+
9
+ This package is available on PyPI.
10
+
11
+ ```bash
12
+ pip install cosmoglint
13
+ ```
14
+
15
+ This package requires PyTorch.
16
+ Please install PyTorch first following https://pytorch.org
17
+
18
+ ## Documentation & Source code
19
+
20
+ GitHub: https://github.com/knmoriwaki/cosmoglint
21
+
22
+ ## Basic usage
23
+
24
+ Load model:
25
+ ```python
26
+ import json
27
+ from cosmoglint.model.transformer import transformer_model
28
+
29
+ with open(f"args.json", "r") as f:
30
+ option = json.load(f, object_hook=lambda d: argparse.Namespace(**d))
31
+
32
+ model = transformer_model(option)
33
+ ```
34
+ with a json file (example):
35
+ ```json
36
+ {"model_name": "transformer1", "max_length": 50, "d_model": 128, "num_layers": 4, "num_heads": 8, "num_features_out": 100, "num_features_in": 4}
37
+ ```
38
+
39
+ Predict probability:
40
+ ```python
41
+ prob = model(context, x)
42
+ ```
43
+
44
+ Generate new galaxies:
45
+ ```python
46
+ generated, prob = model.generate(context, x, prob_threshold=1e-5)
47
+ ```
48
+
49
+ Input:
50
+ - `context`: a tensor of shape `(N, C_h)`, containing the properties of halo.
51
+ - `x`: a tensor of shape `(N, L, C_g)`, containing the properties of up to `L` galaxies for each of the `N` halos in the batch. Each feature vector of size `C_g` may include, for example, the halo mass, relative distance to the halo center, radial velocity, and tangential velocity. Input `None` to generate from scratch.
52
+ - `prob_threshold` (optional): when sampling, the probability below this threshold is set to zero.
53
+
54
+ Output:
55
+ - `prob`: a tensor of shape `(N, L, C_g, d)`. `prob[i,j,k,:]` is the probability distribution over `d` bins for the k-th parameter of the **(j+1)-th galaxy** in the sequence for the i-th batch element.
56
+ - `generated`: a tensor of shape `(N, L, C_g)`. `generated[i,j,k]` is the sampled values for each parameter of **(j+1)-th galaxy** in the sequence for the i-th batch element.
57
+
58
+ Shape:
59
+ - `N`: Batch size
60
+ - `L`: Sequence length
61
+ - `C_h`: Number of halo properties
62
+ - `C_g`: Number of galaxy properties predicted
63
+ - `d`: Number of bins for the probability distribution of each parameter
64
+
65
+ Options:
66
+ | Key | Description |
67
+ |------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
68
+ | **`model_name`** | Name or identifier for the model configuration (default: `"transformer1"`). Available options are:<br> - `"transformer1"`: halo is prepended to the sequence<br> - `"transformer2"`: halo and galaxy features are embedded together | |
69
+ | **`max_length`** | Maximum number of galaxies (sequence length) the model will process per halo.|
70
+ | **`d_model`** | Dimensionality of the internal feature space (i.e., size of the token embeddings and hidden layers in the transformer). |
71
+ | **`num_layers`** | Number of transformer decoder layers stacked in the model. |
72
+ | **`num_heads`** | Number of attention heads in the multi-head self-attention layers. |
73
+ | **`num_features_out`** | Total number of output bins for the probability distribution. |
74
+ | **`num_features_in`** | Number of features per galaxy (e.g., SFR, relative distance, radial/tangential velocity). |
75
+
76
+
77
+ ## Citation
78
+
79
+ If you use CosmoGLINT in your research, please cite [Moriwaki et al. 2025](https://arxiv.org/abs/2506.16843)
80
+
81
+ ```
82
+ @ARTICLE{CosmoGLINT,
83
+ title = {CosmoGLINT: Cosmological Generative Model for Line Intensity Mapping with Transformer},
84
+ author = {{Moriwaki}, Kana and {Jun}, Rui Lan and {Osato}, Ken and {Yoshida}, Naoki},
85
+ journal = {arXiv preprints},
86
+ year = 2025,
87
+ month = jun,
88
+ eid = {arXiv:2506.16843},
89
+ doi = {10.48550/arXiv.2506.16843},
90
+ archivePrefix = {arXiv},
91
+ eprint = {2506.16843},
92
+ primaryClass = {astro-ph.CO}
93
+ }
94
+ ```
@@ -0,0 +1 @@
1
+ __version__ = "1.0.1"
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: cosmoglint
3
+ Version: 1.0.1
4
+ Summary: Transformer-based generative model for galaxies
5
+ Author: Kana Moriwaki
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Kana Moriwaki
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/knmoriwaki/cosmoglint
29
+ Requires-Python: >=3.9
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: numpy
33
+ Requires-Dist: tqdm
34
+ Requires-Dist: h5py
35
+ Requires-Dist: astropy
36
+ Dynamic: license-file
37
+
38
+ # CosmoGLINT: Cosmological Generative model for Line INtensity mapping with Transformer
39
+
40
+ Transformer-based models that generate galaxies.
41
+
42
+ ---
43
+
44
+ ## Installation
45
+
46
+ This package is available on PyPI.
47
+
48
+ ```bash
49
+ pip install cosmoglint
50
+ ```
51
+
52
+ This package requires PyTorch.
53
+ Please install PyTorch first following https://pytorch.org
54
+
55
+ ## Documentation & Source code
56
+
57
+ GitHub: https://github.com/knmoriwaki/cosmoglint
58
+
59
+ ## Basic usage
60
+
61
+ Load model:
62
+ ```python
63
+ import json
64
+ from cosmoglint.model.transformer import transformer_model
65
+
66
+ with open(f"args.json", "r") as f:
67
+ option = json.load(f, object_hook=lambda d: argparse.Namespace(**d))
68
+
69
+ model = transformer_model(option)
70
+ ```
71
+ with a json file (example):
72
+ ```json
73
+ {"model_name": "transformer1", "max_length": 50, "d_model": 128, "num_layers": 4, "num_heads": 8, "num_features_out": 100, "num_features_in": 4}
74
+ ```
75
+
76
+ Predict probability:
77
+ ```python
78
+ prob = model(context, x)
79
+ ```
80
+
81
+ Generate new galaxies:
82
+ ```python
83
+ generated, prob = model.generate(context, x, prob_threshold=1e-5)
84
+ ```
85
+
86
+ Input:
87
+ - `context`: a tensor of shape `(N, C_h)`, containing the properties of halo.
88
+ - `x`: a tensor of shape `(N, L, C_g)`, containing the properties of up to `L` galaxies for each of the `N` halos in the batch. Each feature vector of size `C_g` may include, for example, the halo mass, relative distance to the halo center, radial velocity, and tangential velocity. Input `None` to generate from scratch.
89
+ - `prob_threshold` (optional): when sampling, the probability below this threshold is set to zero.
90
+
91
+ Output:
92
+ - `prob`: a tensor of shape `(N, L, C_g, d)`. `prob[i,j,k,:]` is the probability distribution over `d` bins for the k-th parameter of the **(j+1)-th galaxy** in the sequence for the i-th batch element.
93
+ - `generated`: a tensor of shape `(N, L, C_g)`. `generated[i,j,k]` is the sampled values for each parameter of **(j+1)-th galaxy** in the sequence for the i-th batch element.
94
+
95
+ Shape:
96
+ - `N`: Batch size
97
+ - `L`: Sequence length
98
+ - `C_h`: Number of halo properties
99
+ - `C_g`: Number of galaxy properties predicted
100
+ - `d`: Number of bins for the probability distribution of each parameter
101
+
102
+ Options:
103
+ | Key | Description |
104
+ |------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
105
+ | **`model_name`** | Name or identifier for the model configuration (default: `"transformer1"`). Available options are:<br> - `"transformer1"`: halo is prepended to the sequence<br> - `"transformer2"`: halo and galaxy features are embedded together | |
106
+ | **`max_length`** | Maximum number of galaxies (sequence length) the model will process per halo.|
107
+ | **`d_model`** | Dimensionality of the internal feature space (i.e., size of the token embeddings and hidden layers in the transformer). |
108
+ | **`num_layers`** | Number of transformer decoder layers stacked in the model. |
109
+ | **`num_heads`** | Number of attention heads in the multi-head self-attention layers. |
110
+ | **`num_features_out`** | Total number of output bins for the probability distribution. |
111
+ | **`num_features_in`** | Number of features per galaxy (e.g., SFR, relative distance, radial/tangential velocity). |
112
+
113
+
114
+ ## Citation
115
+
116
+ If you use CosmoGLINT in your research, please cite [Moriwaki et al. 2025](https://arxiv.org/abs/2506.16843)
117
+
118
+ ```
119
+ @ARTICLE{CosmoGLINT,
120
+ title = {CosmoGLINT: Cosmological Generative Model for Line Intensity Mapping with Transformer},
121
+ author = {{Moriwaki}, Kana and {Jun}, Rui Lan and {Osato}, Ken and {Yoshida}, Naoki},
122
+ journal = {arXiv preprints},
123
+ year = 2025,
124
+ month = jun,
125
+ eid = {arXiv:2506.16843},
126
+ doi = {10.48550/arXiv.2506.16843},
127
+ archivePrefix = {arXiv},
128
+ eprint = {2506.16843},
129
+ primaryClass = {astro-ph.CO}
130
+ }
131
+ ```
@@ -1,5 +1,6 @@
1
1
  LICENSE
2
2
  README.md
3
+ README_PYPI.md
3
4
  pyproject.toml
4
5
  cosmoglint/__init__.py
5
6
  cosmoglint.egg-info/PKG-INFO
@@ -1,5 +1,4 @@
1
1
  numpy
2
2
  tqdm
3
3
  h5py
4
- nflows
5
4
  astropy
@@ -4,9 +4,9 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cosmoglint"
7
- version = "1.0.0"
7
+ version = "1.0.1"
8
8
  description = "Transformer-based generative model for galaxies"
9
- readme = "README.md"
9
+ readme = "README_PYPI.md"
10
10
  requires-python = ">=3.9"
11
11
  authors = [{ name = "Kana Moriwaki" }]
12
12
  license = { file = "LICENSE" }
@@ -14,7 +14,6 @@ dependencies = [
14
14
  "numpy",
15
15
  "tqdm",
16
16
  "h5py",
17
- "nflows",
18
17
  "astropy",
19
18
  ]
20
19
 
cosmoglint-1.0.0/PKG-INFO DELETED
@@ -1,164 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: cosmoglint
3
- Version: 1.0.0
4
- Summary: Transformer-based generative model for galaxies
5
- Author: Kana Moriwaki
6
- License: MIT License
7
-
8
- Copyright (c) 2026 Kana Moriwaki
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
28
- Project-URL: Homepage, https://github.com/knmoriwaki/cosmoglint
29
- Requires-Python: >=3.9
30
- Description-Content-Type: text/markdown
31
- License-File: LICENSE
32
- Requires-Dist: numpy
33
- Requires-Dist: tqdm
34
- Requires-Dist: h5py
35
- Requires-Dist: nflows
36
- Requires-Dist: astropy
37
- Dynamic: license-file
38
-
39
- # CosmoGLINT: Cosmological Generative model for Line INtensity mapping with Transformer
40
-
41
- This repository includes:
42
-
43
- - cosmoglint, a package of Transformer-based models that generate galaxy properties from halo mass.
44
- - Scripts for training and mock catalog generation.
45
- - Example notebooks for result visualization.
46
-
47
- Models trained with TNG300-1 at z = 0.5 - 6 and generated data are available at [Google Drive](https://drive.google.com/drive/folders/1IFje9tNRf4Dr3NufqzlDdGMFTEDpsm35?usp=share_link).
48
-
49
- For detailed usage and options, see [DOCUMENTATION](./DOCUMENTATION.md).
50
-
51
- ---
52
-
53
- ## Installation
54
-
55
- Python>=3.9 is required.
56
-
57
- This package requires PyTorch.
58
- Please install PyTorch first following https://pytorch.org
59
-
60
- Install package and from local clone:
61
-
62
- ```bash
63
- git clone https://github.com/knmoriwaki/cosmoglint.git
64
- cd cosmoglint
65
- pip install .
66
- ```
67
-
68
- If you only need the `cosmoglint` package (e.g., to import it in your own code), you can install it directly:
69
-
70
- ```bash
71
- pip install git+https://github.com/knmoriwaki/cosmoglint.git
72
- ```
73
-
74
-
75
- Several libraries needs to be additionally installed to run the scripts and notebooks:
76
- ```bash
77
- pip install -r requirements.txt
78
- ```
79
-
80
- ## Training
81
-
82
- Example:
83
- ```bash
84
- python train_transformer.py --data_path [data_path] --norm_param_file [norm_param_file]
85
- ```
86
-
87
- Options:
88
- - `--data_path`: Path(s) to the training data. Data is an hdf5 file that contains properties of halos and galaxies. In addition to those for input and output features, the number of galaxies in each halo (`GroupNsubs`) should be provided. Multiple files can be passed.
89
- - `--norm_param_file`: Path to the json file that specifies the normalization settings. Each key (e.g., `HaloMass`) maps to a dictionary with `min` / `max` and `norm`. If `norm` is `"log"` or `"log_with_sign"`, the `min` / `max` normalization is applied after the log conversion.
90
- - `--input_features`: List of the input properties (default: `["GroupMass"]`)
91
- - `--output_features`: List of the output properties (default: `["SubhaloSFR", "SubhaloDist", "SubhaloVrad", "SubhaloVtan"]`)
92
- - `--max_length`: Maximum number of galaxies (sequence length) per halo (default: 30).
93
- - `--use_flat_representation`: If true, use flattened point features (B, N * M). If false, keep (B, N, M). Use `--no-use_flat_representation` to set it to false (default: true).
94
-
95
- ## Create mock data cube
96
-
97
- Example:
98
- ```bash
99
- python create_data_cube.py --input_fname [input_fname] --model_dir [model_dir]
100
- ```
101
-
102
- Options:
103
- - `--input_fname`: Path to the halo catalog. Text file that contains halo mass [Msun] in log scale (1st column), comving positions [Mpc/h] (2nd to 4th columns), and velocities [km/s] (5th to 8th columns) and catalog in [Pinocchio](https://github.com/pigimonaco/Pinocchio) format are supported.
104
- - `--model_dir`: Path to a directory containing the trained model (`model.pth` and `args.json`). If not set, column 7 of the input file is used as intensity.
105
- - `--boxsize`: Size of the simulation box in comoving units [Mpc/h] (default: 100.0).
106
- - `--redshift_space`: If set, positions are converted to redshift space using halo velocities.
107
- - `--gen_both`: If set, generates both real-space and redshift-space data cubes.
108
- - `--npix`: Number of pixels in the x and y directions for the data cube (default: 100).
109
- - `--npix_z`: Number of pixels in the z direction (default: 90).
110
-
111
- ## Create lightcone
112
-
113
- Example:
114
- ```bash
115
- python create_lightcone.py --input_fname [input_fname] --model_dir [model_dir] --model_config_file [model_config_file]
116
- ```
117
-
118
- Example of `model_config_file`:
119
- ```json
120
- {
121
- "33": ["transformer1_33_ep40_bs512_w0.02", 2.002],
122
- "21": ["transformer1_21_ep60_bs512_w0.02", 4.008]
123
- }
124
- ```
125
-
126
- - `--input_fname`: Path to the lightcone halo catalog. Pinocchio format is supported.
127
- - `--output_fname`: Output filename (HDF5 format).
128
- - `--model_dir`: Path to a directory containing the trained models.
129
- - `--model_config_file`: Path to a JSON file that contains the names of the trained models to be used for each redshift bin. The JSON file is a dictionary where each key is a stringified snapshot ID, and the value is a list containing the model directory relative to `model_dir` and the redshift.
130
- - `--redshift_space`: If set, generate output in redshift space.
131
- - `redshift_min`, `--redshift_max`: Redshift range for the lightcone.
132
- - `dz`: Redshift bin width. Indicates dlogz if `--use_logz` is given.
133
- - `use_logz`: Use dlogz instead of dz for redshift binning.
134
- - `--side_length`, `--angular_resolution`: Angular size and resolution (arcsec) of the simulated map.
135
- - `--gen_catalog`: If set, generate a galaxy catalog with SFR greater than --catalog_threshold.
136
- - `--catalog_threshold`: SFR threshold for inclusion in the catalog.
137
-
138
- ## Visualization
139
-
140
- Example Jupyter notebooks are available in the `notebooks/` directory:
141
-
142
- - `plot_transformer.ipynb`: visualize training results
143
- - `plot_data_cube.ipynb`: visualize created data cube
144
- - `plot_lightcone.ipynb`: visualize lightcone data
145
-
146
-
147
- ## Citation
148
-
149
- If you use CosmoGLINT in your research, please cite [Moriwaki et al. 2025](https://arxiv.org/abs/2506.16843)
150
-
151
- ```
152
- @ARTICLE{CosmoGLINT,
153
- title = {CosmoGLINT: Cosmological Generative Model for Line Intensity Mapping with Transformer},
154
- author = {{Moriwaki}, Kana and {Jun}, Rui Lan and {Osato}, Ken and {Yoshida}, Naoki},
155
- journal = {arXiv preprints},
156
- year = 2025,
157
- month = jun,
158
- eid = {arXiv:2506.16843},
159
- doi = {10.48550/arXiv.2506.16843},
160
- archivePrefix = {arXiv},
161
- eprint = {2506.16843},
162
- primaryClass = {astro-ph.CO}
163
- }
164
- ```
@@ -1 +0,0 @@
1
- __version__ = "1.0.0"
@@ -1,164 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: cosmoglint
3
- Version: 1.0.0
4
- Summary: Transformer-based generative model for galaxies
5
- Author: Kana Moriwaki
6
- License: MIT License
7
-
8
- Copyright (c) 2026 Kana Moriwaki
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the "Software"), to deal
12
- in the Software without restriction, including without limitation the rights
13
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
- copies of the Software, and to permit persons to whom the Software is
15
- furnished to do so, subject to the following conditions:
16
-
17
- The above copyright notice and this permission notice shall be included in all
18
- copies or substantial portions of the Software.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
- SOFTWARE.
27
-
28
- Project-URL: Homepage, https://github.com/knmoriwaki/cosmoglint
29
- Requires-Python: >=3.9
30
- Description-Content-Type: text/markdown
31
- License-File: LICENSE
32
- Requires-Dist: numpy
33
- Requires-Dist: tqdm
34
- Requires-Dist: h5py
35
- Requires-Dist: nflows
36
- Requires-Dist: astropy
37
- Dynamic: license-file
38
-
39
- # CosmoGLINT: Cosmological Generative model for Line INtensity mapping with Transformer
40
-
41
- This repository includes:
42
-
43
- - cosmoglint, a package of Transformer-based models that generate galaxy properties from halo mass.
44
- - Scripts for training and mock catalog generation.
45
- - Example notebooks for result visualization.
46
-
47
- Models trained with TNG300-1 at z = 0.5 - 6 and generated data are available at [Google Drive](https://drive.google.com/drive/folders/1IFje9tNRf4Dr3NufqzlDdGMFTEDpsm35?usp=share_link).
48
-
49
- For detailed usage and options, see [DOCUMENTATION](./DOCUMENTATION.md).
50
-
51
- ---
52
-
53
- ## Installation
54
-
55
- Python>=3.9 is required.
56
-
57
- This package requires PyTorch.
58
- Please install PyTorch first following https://pytorch.org
59
-
60
- Install package and from local clone:
61
-
62
- ```bash
63
- git clone https://github.com/knmoriwaki/cosmoglint.git
64
- cd cosmoglint
65
- pip install .
66
- ```
67
-
68
- If you only need the `cosmoglint` package (e.g., to import it in your own code), you can install it directly:
69
-
70
- ```bash
71
- pip install git+https://github.com/knmoriwaki/cosmoglint.git
72
- ```
73
-
74
-
75
- Several libraries needs to be additionally installed to run the scripts and notebooks:
76
- ```bash
77
- pip install -r requirements.txt
78
- ```
79
-
80
- ## Training
81
-
82
- Example:
83
- ```bash
84
- python train_transformer.py --data_path [data_path] --norm_param_file [norm_param_file]
85
- ```
86
-
87
- Options:
88
- - `--data_path`: Path(s) to the training data. Data is an hdf5 file that contains properties of halos and galaxies. In addition to those for input and output features, the number of galaxies in each halo (`GroupNsubs`) should be provided. Multiple files can be passed.
89
- - `--norm_param_file`: Path to the json file that specifies the normalization settings. Each key (e.g., `HaloMass`) maps to a dictionary with `min` / `max` and `norm`. If `norm` is `"log"` or `"log_with_sign"`, the `min` / `max` normalization is applied after the log conversion.
90
- - `--input_features`: List of the input properties (default: `["GroupMass"]`)
91
- - `--output_features`: List of the output properties (default: `["SubhaloSFR", "SubhaloDist", "SubhaloVrad", "SubhaloVtan"]`)
92
- - `--max_length`: Maximum number of galaxies (sequence length) per halo (default: 30).
93
- - `--use_flat_representation`: If true, use flattened point features (B, N * M). If false, keep (B, N, M). Use `--no-use_flat_representation` to set it to false (default: true).
94
-
95
- ## Create mock data cube
96
-
97
- Example:
98
- ```bash
99
- python create_data_cube.py --input_fname [input_fname] --model_dir [model_dir]
100
- ```
101
-
102
- Options:
103
- - `--input_fname`: Path to the halo catalog. Text file that contains halo mass [Msun] in log scale (1st column), comving positions [Mpc/h] (2nd to 4th columns), and velocities [km/s] (5th to 8th columns) and catalog in [Pinocchio](https://github.com/pigimonaco/Pinocchio) format are supported.
104
- - `--model_dir`: Path to a directory containing the trained model (`model.pth` and `args.json`). If not set, column 7 of the input file is used as intensity.
105
- - `--boxsize`: Size of the simulation box in comoving units [Mpc/h] (default: 100.0).
106
- - `--redshift_space`: If set, positions are converted to redshift space using halo velocities.
107
- - `--gen_both`: If set, generates both real-space and redshift-space data cubes.
108
- - `--npix`: Number of pixels in the x and y directions for the data cube (default: 100).
109
- - `--npix_z`: Number of pixels in the z direction (default: 90).
110
-
111
- ## Create lightcone
112
-
113
- Example:
114
- ```bash
115
- python create_lightcone.py --input_fname [input_fname] --model_dir [model_dir] --model_config_file [model_config_file]
116
- ```
117
-
118
- Example of `model_config_file`:
119
- ```json
120
- {
121
- "33": ["transformer1_33_ep40_bs512_w0.02", 2.002],
122
- "21": ["transformer1_21_ep60_bs512_w0.02", 4.008]
123
- }
124
- ```
125
-
126
- - `--input_fname`: Path to the lightcone halo catalog. Pinocchio format is supported.
127
- - `--output_fname`: Output filename (HDF5 format).
128
- - `--model_dir`: Path to a directory containing the trained models.
129
- - `--model_config_file`: Path to a JSON file that contains the names of the trained models to be used for each redshift bin. The JSON file is a dictionary where each key is a stringified snapshot ID, and the value is a list containing the model directory relative to `model_dir` and the redshift.
130
- - `--redshift_space`: If set, generate output in redshift space.
131
- - `redshift_min`, `--redshift_max`: Redshift range for the lightcone.
132
- - `dz`: Redshift bin width. Indicates dlogz if `--use_logz` is given.
133
- - `use_logz`: Use dlogz instead of dz for redshift binning.
134
- - `--side_length`, `--angular_resolution`: Angular size and resolution (arcsec) of the simulated map.
135
- - `--gen_catalog`: If set, generate a galaxy catalog with SFR greater than --catalog_threshold.
136
- - `--catalog_threshold`: SFR threshold for inclusion in the catalog.
137
-
138
- ## Visualization
139
-
140
- Example Jupyter notebooks are available in the `notebooks/` directory:
141
-
142
- - `plot_transformer.ipynb`: visualize training results
143
- - `plot_data_cube.ipynb`: visualize created data cube
144
- - `plot_lightcone.ipynb`: visualize lightcone data
145
-
146
-
147
- ## Citation
148
-
149
- If you use CosmoGLINT in your research, please cite [Moriwaki et al. 2025](https://arxiv.org/abs/2506.16843)
150
-
151
- ```
152
- @ARTICLE{CosmoGLINT,
153
- title = {CosmoGLINT: Cosmological Generative Model for Line Intensity Mapping with Transformer},
154
- author = {{Moriwaki}, Kana and {Jun}, Rui Lan and {Osato}, Ken and {Yoshida}, Naoki},
155
- journal = {arXiv preprints},
156
- year = 2025,
157
- month = jun,
158
- eid = {arXiv:2506.16843},
159
- doi = {10.48550/arXiv.2506.16843},
160
- archivePrefix = {arXiv},
161
- eprint = {2506.16843},
162
- primaryClass = {astro-ph.CO}
163
- }
164
- ```
File without changes
File without changes
File without changes