Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
6a7124c
first attempt on adding dust. Started to implement extinction laws fo…
Jan 29, 2025
77f04a4
very rough version of a dust model.
Jan 31, 2025
fe4b946
Improves FITS storage: Adds NIHAO support
nihatog Jan 31, 2025
5045f8b
Update fits.py (the extract_info_from_path() function now extracts th…
nihatog Feb 3, 2025
aca472e
almost working version. Only missing part is the gas metallicity.
Feb 10, 2025
3bd552f
compare ssp on ifu cubes
anschaible Feb 12, 2025
23db802
not reload ssp template for fsps for every star new, use saved one
anschaible Feb 12, 2025
1718321
compare templates
anschaible Feb 12, 2025
84306c1
notebooks for plots for the paper
anschaible Feb 13, 2025
8a601ea
try ifu calculation with jax float 64
anschaible Feb 13, 2025
e66fdf3
finally a efficient working version of dust attenuation.
Feb 13, 2025
db69669
first draft dust attenuation notebook to test the implementation
Feb 13, 2025
f824865
compare grids
anschaible Feb 13, 2025
e06397e
added unit tests for the dust model
Feb 13, 2025
01f3e74
now with some example notebook.
Feb 13, 2025
8c73d9a
small fixes to make tests pass.
Feb 13, 2025
cf69766
now the galaxy id and the snapshot are extracted directly from the co…
nihatog Feb 14, 2025
3fe5a09
now we have galaxy id and snapshot in the config, and we can decide w…
nihatog Feb 14, 2025
1a71a5d
takes path and halo path from mnt/storage (removed my path)
nihatog Feb 14, 2025
e3525db
fixed comments and nans throuhg filter particle function
Feb 21, 2025
ef01e01
now with small fix to make the notebook test pass
Feb 23, 2025
5bcd4a7
Merge pull request #132 from ufuk-cakir/nihao-fits-fix
anschaible Feb 24, 2025
7cec412
enable device information logging and jax version logging on first st…
Feb 26, 2025
bdd91f9
added isort to pre-commit hooks
Feb 26, 2025
35bd0f9
fixed typos
Feb 26, 2025
ce878ea
fix test via lower jax version
Feb 26, 2025
84459b9
Merge pull request #134 from ufuk-cakir/61-simple-dust-attenuation
TobiBu Feb 28, 2025
8b287e1
Merge pull request #135 from ufuk-cakir/device_logging
TobiBu Feb 28, 2025
0043c06
plot velocity map
anschaible Mar 5, 2025
71de9c5
fsps not created from scratch
anschaible Mar 5, 2025
f03f21f
velocity in km/s
anschaible Mar 5, 2025
76a4029
look into doppler shift, but do not change anything
anschaible Mar 5, 2025
466c7db
update gitignore
anschaible Mar 5, 2025
b03b737
doppler shift in z direction to get realistic velocity field of galaxy
anschaible Mar 6, 2025
8063810
changes in notebook
anschaible Mar 6, 2025
e77a802
skip cells in notebook for tests
anschaible Mar 6, 2025
ee789d5
update project.toml and fix pytests
anschaible Mar 6, 2025
99b2975
update pyproject.toml
anschaible Mar 6, 2025
d72c77e
fix issue, that it gets for a lot of particles nonsense, it is not ni…
anschaible Mar 7, 2025
73211f8
fixes in the notebook to let test pass
anschaible Mar 7, 2025
1567fee
dust extinction
anschaible Mar 10, 2025
2480544
Revert "dust extinction"
anschaible Mar 10, 2025
87b556d
dust extinction fixes to be runable
anschaible Mar 10, 2025
5628587
Merge pull request #136 from ufuk-cakir/ngist_compatibility
nihatog Mar 11, 2025
2ea8a7a
figure out that fsps template is offset
anschaible Mar 13, 2025
fdbc006
fix fsps wavelength offset
anschaible Mar 14, 2025
ef7d3b7
Merge branch 'main' into compare_ssp
anschaible Mar 14, 2025
d07bd38
gitignore
anschaible Mar 14, 2025
aa508d1
comment out notebook cells
anschaible Mar 14, 2025
ae690cf
fix fsps test to account for the new wavelemgth shift introduced in t…
Mar 14, 2025
46bfa5e
add metals in pynbody handler that are needed for dust computation, h…
anschaible Apr 1, 2025
08dbdac
fix rotation for nihao
anschaible Apr 1, 2025
62c3e21
fix rotation for nihao galaxies
anschaible Apr 1, 2025
9c60c7c
fix wrong age for nihao
anschaible Apr 1, 2025
d5e303f
fits file saving
anschaible Apr 1, 2025
131f0ec
reduce chunk size for spectral assignment
anschaible Apr 2, 2025
4f25d70
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Apr 7, 2025
17b6448
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 7, 2025
f4e569c
compare ifu cubes notebook
anschaible Apr 15, 2025
ac06892
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 15, 2025
282a965
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 27, 2025
e6b07b5
Implement review comment: offset = (_wave[1] - _wave[0]) / 2.
anschaible May 28, 2025
7d0c7af
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 28, 2025
dbb4487
Merge pull request #139 from AstroAI-Lab/pre-commit-ci-update-config
anschaible May 28, 2025
df23f1f
update apertures
anschaible Jun 2, 2025
c8cbffa
merge conflicts
anschaible Jun 2, 2025
2f94f01
Merge main into this side branch
anschaible Jun 2, 2025
8c6aa4b
fix pytests for the fsps wavelength offset
anschaible Jun 2, 2025
4a21f30
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 2, 2025
587cd68
fix pytest for galaxy rotation
anschaible Jun 2, 2025
11048d8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 2, 2025
0687644
Update rubix/spectra/ssp/fsps_grid.py
anschaible Jun 11, 2025
d15ef58
update stellar age in pynbody
anschaible Jun 11, 2025
915feb8
Merge branch 'main' into fix-stellar-age
anschaible Jun 11, 2025
a64b863
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 11, 2025
2724e3f
Update tests/test_ssp_fsps.py
anschaible Jun 11, 2025
25637d5
fix pytest
anschaible Jun 11, 2025
5259cf3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 11, 2025
0e828b2
fix typo in notebook
Jul 1, 2025
01f1a31
more typos fixed
Jul 1, 2025
e38e8fd
Merge pull request #153 from AstroAI-Lab/dust_notebook-fix
anschaible Jul 2, 2025
7c86bf0
Merge pull request #137 from AstroAI-Lab/compare_ssp
anschaible Jul 2, 2025
8038901
add comment in rotation
anschaible Jul 2, 2025
213b85c
Merge branch 'main' into fix-stellar-age
anschaible Jul 2, 2025
75efd92
Merge pull request #138 from AstroAI-Lab/fix-stellar-age
TobiBu Jul 3, 2025
f55baf3
Bump actions/checkout from 4 to 5
dependabot[bot] Sep 2, 2025
31934cc
Bump pypa/gh-action-pypi-publish from 1.12.4 to 1.13.0
dependabot[bot] Oct 1, 2025
dd75eaa
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Oct 13, 2025
b51d566
Merge pull request #157 from AstroAI-Lab/dependabot/github_actions/ac…
TobiBu Oct 16, 2025
fe864a5
Bump actions/setup-python from 5 to 6
dependabot[bot] Oct 16, 2025
3ffaa35
Exclude jax[cpu] version 0.8.0 from dependencies
TobiBu Oct 24, 2025
670b9ea
Exclude jax[cpu] version 0.7.2
TobiBu Oct 24, 2025
ce595d3
Update pyproject.toml
TobiBu Oct 24, 2025
9d908a5
Exclude jax[cpu] version 0.7.0
TobiBu Oct 24, 2025
ae60edf
Exclude jax[cpu] version 0.6.2
TobiBu Oct 24, 2025
71001b0
Exclude jax[cpu] version 0.6.1
TobiBu Oct 24, 2025
b35c48e
Exclude jax[cpu] version 0.6.0 from dependencies
TobiBu Oct 24, 2025
17a4023
Exclude jax[cpu] version 0.5.3
TobiBu Oct 24, 2025
25412a4
Exclude jax[cpu] version 0.5.2
TobiBu Oct 24, 2025
6ea1ecc
Clean up jax[cpu] version exclusions in pyproject.toml
TobiBu Oct 25, 2025
39db4a3
Add typechecker to _cumtrapz_scan_func decorator
TobiBu Oct 25, 2025
2fefe48
switch @jit and typechecker decorator to make tests pass.
Oct 25, 2025
81b5671
switch @jit with typechecker decorator to make tests pass.
Oct 25, 2025
ec93658
Merge pull request #159 from AstroAI-Lab/dependabot/github_actions/py…
TobiBu Oct 25, 2025
312b75b
Merge pull request #160 from AstroAI-Lab/main
TobiBu Oct 25, 2025
278cb29
Merge pull request #158 from AstroAI-Lab/dependabot/github_actions/ac…
TobiBu Oct 25, 2025
afd7e41
Merge pull request #161 from AstroAI-Lab/main
TobiBu Oct 25, 2025
e354e1c
Merge pull request #156 from AstroAI-Lab/pre-commit-ci-update-config
TobiBu Oct 25, 2025
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
# setuptools_scm requires a non-shallow clone of the repository
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -52,10 +52,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.11"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
id-token: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
# setuptools_scm requires a non-shallow clone of the repository
fetch-depth: 0

- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
name: Install Python

- name: Build SDist
run: pipx run build --sdist

- uses: pypa/gh-action-pypi-publish@v1.12.4
- uses: pypa/gh-action-pypi-publish@v1.13.0
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,11 @@ cython_debug/
rubix/version.py
notebooks/*.h5
notebooks/output
notebooks/frames

rubix/**/*.ipynb

rubix/spectra/ssp/templates/fsps.h5
rubix/spectra/ssp/templates/*.gz
rubix/spectra/ssp/templates/*fits.gz
rubix/spectra/cue/cue/*
Expand All @@ -169,3 +171,8 @@ utils/*
firebase.json
.firebase/*

rubix/spectra/ssp/templates/fsps.h5

notebooks/frames
notebooks/frames/*
notebooks/data/*
13 changes: 9 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@

repos:
- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
rev: 0.8.1
hooks:
- id: nbstripout
files: ".ipynb"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v6.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 24.2.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.9.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 7.0.0
hooks:
- id: isort
name: isort (python)
253 changes: 253 additions & 0 deletions notebooks/compare_filtercurves.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#NBVAL_SKIP\n",
"import os\n",
"#os.environ['SPS_HOME'] = '/Users/annalena/Documents/GitHub/fsps'\n",
"os.environ['SPS_HOME'] = '/home/annalena/sps_fsps'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#NBVAL_SKIP\n",
"config = {\n",
" \"pipeline\": {\"name\": \"calc_ifu\"},\n",
" \n",
" \"logger\": {\n",
" \"log_level\": \"DEBUG\",\n",
" \"log_file_path\": None,\n",
" \"format\": \"%(asctime)s - %(name)s - %(levelname)s - %(message)s\",\n",
" },\n",
" \"data\": {\n",
" \"name\": \"IllustrisAPI\",\n",
" \"args\": {\n",
" \"api_key\": os.environ.get(\"ILLUSTRIS_API_KEY\"),\n",
" \"particle_type\": [\"stars\"],\n",
" \"simulation\": \"TNG50-1\",\n",
" \"snapshot\": 99,\n",
" \"save_data_path\": \"data\",\n",
" },\n",
" \n",
" \"load_galaxy_args\": {\n",
" \"id\": 11,\n",
" \"reuse\": True,\n",
" },\n",
"\n",
" \"subset\": {\n",
" \"use_subset\": True,\n",
" \"subset_size\": 100000,\n",
" },\n",
" },\n",
" \"simulation\": {\n",
" \"name\": \"IllustrisTNG\",\n",
" \"args\": {\n",
" \"path\": \"data/galaxy-id-11.hdf5\",\n",
" },\n",
" \n",
" },\n",
" \"output_path\": \"output\",\n",
" \"output_modified\": False,\n",
"\n",
" \"telescope\": {\n",
" \"name\": \"MUSE\",\n",
" \"psf\": {\"name\": \"gaussian\", \"size\": 5, \"sigma\": 0.5},\n",
" \"lsf\": {\"sigma\": 0.5},\n",
" \"noise\": {\"signal_to_noise\": 100, \"noise_distribution\": \"normal\"},\n",
" },\n",
" \"cosmology\": {\"name\": \"PLANCK15\"},\n",
" \"galaxy\": {\n",
" \"dist_z\": 0.1,\n",
" \"rotation\": {\"type\": \"face-on\"},\n",
" },\n",
" \"ssp\": {\n",
" \"template\": {\"name\": \"FSPS\"},\n",
" },\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#NBVAL_SKIP\n",
"import jax.numpy as jnp\n",
"from rubix.core.pipeline import RubixPipeline\n",
"pipe = RubixPipeline(config)\n",
"\n",
"rubixdata = pipe.run()\n",
"rubixdata_fsps = rubixdata"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#NBVAL_SKIP\n",
"from rubix.spectra.ifu import convert_luminoisty_to_flux\n",
"from rubix.cosmology import PLANCK15\n",
"\n",
"observation_lum_dist = PLANCK15.luminosity_distance_to_z(config[\"galaxy\"][\"dist_z\"])\n",
"observation_z = config[\"galaxy\"][\"dist_z\"]\n",
"pixel_size = 1.0\n",
"\n",
"spectra_fsps = convert_luminoisty_to_flux(rubixdata_fsps.stars.datacube, observation_lum_dist, observation_z, pixel_size)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#NBVAL_SKIP\n",
"from rubix.telescope.filters import load_filter, print_filter_list, print_filter_list_info, print_filter_property\n",
"# NBVAL_SKIP\n",
"# load all fliter curves for SLOAN\n",
"curves = load_filter(\"SLOAN\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# NBVAL_SKIP\n",
"curves.plot()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#NBVAL_SKIP\n",
"from rubix.telescope.filters import convolve_filter_with_spectra\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# NBVAL_SKIP\n",
"wave = pipe.telescope.wave_seq\n",
"datacube = spectra_fsps\n",
"\n",
"for filter in curves:\n",
" convolved = convolve_filter_with_spectra(filter, datacube, wave)\n",
" plt.figure()\n",
" plt.imshow(convolved)\n",
" plt.colorbar()\n",
" plt.title(filter.name)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#NBVAL_SKIP\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from matplotlib.cm import ScalarMappable\n",
"from matplotlib.colors import Normalize\n",
"\n",
"# Assuming curves, datacube, and wave are defined\n",
"num_filters = len(curves)\n",
"nrows = 2\n",
"ncols = 5\n",
"\n",
"fig, axes = plt.subplots(nrows, ncols, figsize=(15, 6))\n",
"\n",
"# Find the global min and max for the colorbars for each row\n",
"vmin_row1 = np.inf\n",
"vmax_row1 = -np.inf\n",
"vmin_row2 = np.inf\n",
"vmax_row2 = -np.inf\n",
"convolved_list = []\n",
"\n",
"for i, filter in enumerate(curves):\n",
" convolved = convolve_filter_with_spectra(filter, datacube, wave)\n",
" convolved_list.append(convolved)\n",
" if i in [0, 3, 5, 7, 9]: # First row\n",
" vmin_row1 = min(vmin_row1, convolved.min())\n",
" vmax_row1 = max(vmax_row1, convolved.max())\n",
" else: # Second row\n",
" vmin_row2 = min(vmin_row2, convolved.min())\n",
" vmax_row2 = max(vmax_row2, convolved.max())\n",
"\n",
"# Plot each convolved image in the grid\n",
"for i, ax in enumerate(axes.flat):\n",
" if i < 5: # First row\n",
" filter_index = [0, 3, 5, 7, 9][i]\n",
" im = ax.imshow(convolved_list[filter_index], vmin=vmin_row1, vmax=vmax_row1, cmap='viridis')\n",
" ax.set_title(curves[filter_index].name)\n",
" else: # Second row\n",
" filter_index = [1, 2, 4, 6, 8][i - 5]\n",
" im = ax.imshow(convolved_list[filter_index], vmin=vmin_row2, vmax=vmax_row2, cmap='inferno')\n",
" ax.set_title(curves[filter_index].name)\n",
" ax.axis('off')\n",
"\n",
"# Adjust layout with tight_layout\n",
"plt.tight_layout()\n",
"\n",
"# Create smaller axes for the colorbars outside the grid\n",
"fig.subplots_adjust(right=0.85)\n",
"cbar_ax1 = fig.add_axes([0.87, 0.55, 0.02, 0.35]) # Position for the colorbar of the first row\n",
"cbar_ax2 = fig.add_axes([0.87, 0.07, 0.02, 0.35]) # Position for the colorbar of the second row\n",
"\n",
"# Create ScalarMappable objects for the colorbars\n",
"norm_row1 = Normalize(vmin=vmin_row1, vmax=vmax_row1)\n",
"norm_row2 = Normalize(vmin=vmin_row2, vmax=vmax_row2)\n",
"sm_row1 = ScalarMappable(norm=norm_row1, cmap='viridis')\n",
"sm_row2 = ScalarMappable(norm=norm_row2, cmap='inferno')\n",
"\n",
"# Add colorbars for each row with different colormaps\n",
"fig.colorbar(sm_row1, cax=cbar_ax1)\n",
"fig.colorbar(sm_row2, cax=cbar_ax2)\n",
"\n",
"plt.savefig(\"output/filters_fsps_galaxy.png\")\n",
"plt.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "rubix",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading
Loading