astrosnap 0.1.0a1__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.
- astrosnap-0.1.0a1/LICENSE +28 -0
- astrosnap-0.1.0a1/PKG-INFO +24 -0
- astrosnap-0.1.0a1/README.md +3 -0
- astrosnap-0.1.0a1/pyproject.toml +30 -0
- astrosnap-0.1.0a1/setup.cfg +4 -0
- astrosnap-0.1.0a1/src/astrosnap/__init__.py +0 -0
- astrosnap-0.1.0a1/src/astrosnap/prospector.py +71 -0
- astrosnap-0.1.0a1/src/astrosnap.egg-info/PKG-INFO +24 -0
- astrosnap-0.1.0a1/src/astrosnap.egg-info/SOURCES.txt +10 -0
- astrosnap-0.1.0a1/src/astrosnap.egg-info/dependency_links.txt +1 -0
- astrosnap-0.1.0a1/src/astrosnap.egg-info/requires.txt +4 -0
- astrosnap-0.1.0a1/src/astrosnap.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Neil Ghugare
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: astrosnap
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Research script tools and helper functions for galaxy simulation analysis.
|
|
5
|
+
Author-email: Neil Ghugare <nghugare2@outlook.com>
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/RandomKiddo/astrosnap
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: astropy
|
|
18
|
+
Requires-Dist: h5py
|
|
19
|
+
Requires-Dist: matplotlib
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# AstroSnap
|
|
23
|
+
|
|
24
|
+
`Copyright © 2026, Neil Ghugare`
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "astrosnap"
|
|
7
|
+
version = "0.1.0a1"
|
|
8
|
+
description = "Research script tools and helper functions for galaxy simulation analysis."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Neil Ghugare", email = "nghugare2@outlook.com" }
|
|
12
|
+
]
|
|
13
|
+
license = { text = "BSD-3-Clause" }
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: BSD License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Astronomy",
|
|
20
|
+
]
|
|
21
|
+
requires-python = ">=3.8"
|
|
22
|
+
dependencies = [
|
|
23
|
+
"numpy",
|
|
24
|
+
"astropy",
|
|
25
|
+
"h5py",
|
|
26
|
+
"matplotlib",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/RandomKiddo/astrosnap"
|
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""
|
|
2
|
+
File: prospector.py
|
|
3
|
+
|
|
4
|
+
Prospector helper tools for preparation of Prospector fit running and later analysis.
|
|
5
|
+
|
|
6
|
+
Programmer: Neil Ghugare
|
|
7
|
+
|
|
8
|
+
Revision History:
|
|
9
|
+
09/19/2026 - Created initial version.
|
|
10
|
+
|
|
11
|
+
Notes:
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import glob
|
|
15
|
+
import os
|
|
16
|
+
import warnings
|
|
17
|
+
|
|
18
|
+
from typing import *
|
|
19
|
+
from tqdm import tqdm
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def create_slurm_array_text(fp: str, zred: float, snap_num: int, output: Optional[str] = 'galaxy_list.txt') -> None:
|
|
23
|
+
"""
|
|
24
|
+
Creates a .txt file that can be used for a SLURM job array.
|
|
25
|
+
|
|
26
|
+
Arguments (Required)
|
|
27
|
+
1. fp: The file path/directory where the .rtout.sed files are located
|
|
28
|
+
2. zred: The redshift of the files.
|
|
29
|
+
3. snap_num: The snapshot number of the simulation suite.
|
|
30
|
+
|
|
31
|
+
Arguments (Optional)
|
|
32
|
+
1. output: The output .txt file name.
|
|
33
|
+
|
|
34
|
+
Returns
|
|
35
|
+
|
|
36
|
+
None.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
# Use glob to read in all the available .rtout.sed files in the directory.
|
|
40
|
+
files = glob.glob(os.path.join(fp, '*.rtout.sed'))
|
|
41
|
+
|
|
42
|
+
# Open up the output file.
|
|
43
|
+
with open(output, 'w') as f:
|
|
44
|
+
# Write a header for the .txt file table.
|
|
45
|
+
f.write('# galaxyid zred directory snap_num\n')
|
|
46
|
+
|
|
47
|
+
# Iterate the files.
|
|
48
|
+
# TQDM allows for a nice loading bar output.
|
|
49
|
+
for fp in tqdm(files):
|
|
50
|
+
# Fetch the base .rtout.sed file name without the path.
|
|
51
|
+
fn = os.path.basename(fp)
|
|
52
|
+
|
|
53
|
+
# Attempt to dynamically extract the galaxy id.
|
|
54
|
+
# ! This expects that the galaxy snapshot output is in the following format:
|
|
55
|
+
# ! snap[no.]_galaxy[no.].rtout.sed, where [no.] represents the number of the snapshot and galaxy, respectively.
|
|
56
|
+
# TODO: Make this work for more formats.
|
|
57
|
+
try:
|
|
58
|
+
galaxy_id = fn[fn.index('galaxy')+6:fn.index('rtout')-1]
|
|
59
|
+
galaxy_id = int(galaxy_id)
|
|
60
|
+
except Exception:
|
|
61
|
+
# If we encounter an error, skip.
|
|
62
|
+
warnings.warn(f'Galaxy ID for file {fn} could not be resolved. Skipping...')
|
|
63
|
+
continue
|
|
64
|
+
|
|
65
|
+
# Write the data to the output file.
|
|
66
|
+
f.write(f'{galaxy_id} {zred} {fp} {snap_num}\n')
|
|
67
|
+
|
|
68
|
+
# Close the file.
|
|
69
|
+
f.close()
|
|
70
|
+
|
|
71
|
+
return
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: astrosnap
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Research script tools and helper functions for galaxy simulation analysis.
|
|
5
|
+
Author-email: Neil Ghugare <nghugare2@outlook.com>
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/RandomKiddo/astrosnap
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: numpy
|
|
17
|
+
Requires-Dist: astropy
|
|
18
|
+
Requires-Dist: h5py
|
|
19
|
+
Requires-Dist: matplotlib
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# AstroSnap
|
|
23
|
+
|
|
24
|
+
`Copyright © 2026, Neil Ghugare`
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/astrosnap/__init__.py
|
|
5
|
+
src/astrosnap/prospector.py
|
|
6
|
+
src/astrosnap.egg-info/PKG-INFO
|
|
7
|
+
src/astrosnap.egg-info/SOURCES.txt
|
|
8
|
+
src/astrosnap.egg-info/dependency_links.txt
|
|
9
|
+
src/astrosnap.egg-info/requires.txt
|
|
10
|
+
src/astrosnap.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
astrosnap
|