Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
06166d4
machinery to fit 1d app mag funcs
zaidikumail Jun 6, 2026
8bf3860
define mag_bin_edges for feniks in conftest
zaidikumail Jun 6, 2026
653906e
2D conditioned color spaces of Feniks
zaidikumail Jun 6, 2026
4731c38
fit_N_phot_2d
zaidikumail Jun 6, 2026
debd9ef
add K band app mag func to fitting
zaidikumail Jun 6, 2026
81e3fb2
adjust mag weights
zaidikumail Jun 7, 2026
7543846
mag_thresh
zaidikumail Jun 7, 2026
9b121d4
add u-band app mag func to loss
zaidikumail Jun 7, 2026
23d6b51
fit 2D colors spaces in coarse z-bins and 1D app mag funcs in fine z-…
zaidikumail Jun 7, 2026
2b6c451
include r-band app mag func in fitting
zaidikumail Jun 7, 2026
887ab7d
(r − i | K), (r − z | K), (J − H | K)
zaidikumail Jun 7, 2026
969412a
1D (i − z | K)
zaidikumail Jun 7, 2026
30440fc
fit hizels+feniks
zaidikumail Jun 8, 2026
a2971b0
add in 1D (J − H | K) in z1 and z2
zaidikumail Jun 8, 2026
19c0072
normalize phot and emline loss based on number of bins
zaidikumail Jun 8, 2026
640f077
grad clipping on
zaidikumail Jun 8, 2026
dd87477
plot weighted loss_phot and loss_emline
zaidikumail Jun 8, 2026
c50520c
no grad clipping
zaidikumail Jun 8, 2026
9c7c3d1
load_sdss
zaidikumail Jun 8, 2026
a293ba2
load sdss 2D
zaidikumail Jun 9, 2026
9659943
fit_sdss_feniks
zaidikumail Jun 9, 2026
a124c01
apply completeness cuts in each band in sdss
zaidikumail Jun 9, 2026
c0b3441
mag_thresh_mask sdss
zaidikumail Jun 9, 2026
5c43e5c
fix sdss z-bins and add r-i|r in fitting
zaidikumail Jun 10, 2026
a522a7b
cond_min, cond_max
zaidikumail Jun 10, 2026
74f1aec
plot_contours
zaidikumail Jun 10, 2026
6393e81
fit all app mag funcs feniks
zaidikumail Jun 10, 2026
46eaae5
2D color-mag diagrams in fitting sdss and feniks
zaidikumail Jun 10, 2026
c1c655c
update N_phot and loss
zaidikumail Jun 10, 2026
c6b5bf0
Update load_sdss.py
zaidikumail Jun 10, 2026
c5abb19
enlarge mag bin width in CMD
zaidikumail Jun 10, 2026
37a0321
reintroduce conditional colors
zaidikumail Jun 10, 2026
59c0398
fit only u,rK app mag func for feniks
zaidikumail Jun 10, 2026
a0cde61
fit only u and r app mag funcs for sdss
zaidikumail Jun 10, 2026
738f00a
Update phot_loss.py
zaidikumail Jun 10, 2026
e7e8e49
Update phot_loss.py
zaidikumail Jun 10, 2026
f695c71
ugriz sdss app mag func all in fitting
zaidikumail Jun 11, 2026
5665af2
exclude highest z-bins in feniks and sdss due to low counts
zaidikumail Jun 11, 2026
85201b7
fit all app mag funcs for feniks
zaidikumail Jun 11, 2026
8d1ad2e
even more conservative estimates of complete mags in sdss and feniks
zaidikumail Jun 11, 2026
bcb754d
condr in sdss
zaidikumail Jun 12, 2026
7915cd2
Update load_feniks.py
zaidikumail Jun 12, 2026
a100b3e
sdss until z=0.16
zaidikumail Jun 12, 2026
20e2b48
plot_smhm_in_situ
zaidikumail Jun 12, 2026
44431ce
Update load_sdss.py
zaidikumail Jun 12, 2026
c9c4169
feniks: include CMDs in loss along with the conditional 1D colors
zaidikumail Jun 12, 2026
65603f5
feniks until z=2.5
zaidikumail Jun 12, 2026
57168a4
use narrow-band colors with broadbands to detect absorption depth, t…
zaidikumail Jun 13, 2026
ee91f28
fix bug in compute_cat_weights: obs_mags was being used instead of ob…
zaidikumail Jun 13, 2026
f88e55f
remove NBs from fitting for now
zaidikumail Jun 13, 2026
0f59e76
# noqa: E741
zaidikumail Jun 13, 2026
d062597
Update load_sdss.py
zaidikumail Jun 13, 2026
b491525
filter_name_to_idx
zaidikumail Jun 13, 2026
8c94ac3
CMD fit false for feniks
zaidikumail Jun 14, 2026
a46530a
diffsky.git@v0.3.6
zaidikumail Jun 14, 2026
613b2c6
remove emline_luminosity_pop
zaidikumail Jun 14, 2026
2707955
limit fitting spaces to fix loss descent for feniks
zaidikumail Jun 14, 2026
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
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Pull Request into main
name: Test Pull Request into main with diffsky@v0.3.6

on:
push:
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
scipy \
python-build
pip uninstall diffsky --yes
pip install --no-deps git+https://github.com/ArgonneCPAC/diffsky.git
pip install --no-deps git+https://github.com/ArgonneCPAC/diffsky.git@v0.3.6

python -m pip install --no-build-isolation --no-deps -e .

Expand Down
15 changes: 15 additions & 0 deletions diffhtwo/experimental/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def feniks(ran_key, fake_subset_ssp_data):
ssp_data,
phot=PHOT,
zout=ZOUT,
add_random_rows_for_testing=True,
)
return feniks

Expand All @@ -72,6 +73,20 @@ def feniks_tcurves():
return tcurves


@pytest.fixture(scope="session")
def feniks_fitting_data(ran_key, fake_subset_ssp_data):
ssp_data, emline_wave_aa = fake_subset_ssp_data
feniks_fitting_data = load_feniks.get_feniks_fitting_data(
FENIKS_DRN,
ran_key,
ssp_data,
phot=PHOT,
zout=ZOUT,
add_random_rows_for_testing=True,
)
return feniks_fitting_data


@pytest.fixture(scope="session")
def feniks_single_z_data(ran_key, fake_subset_ssp_data, feniks):
ssp_data, emline_wave_aa = fake_subset_ssp_data
Expand Down
145 changes: 145 additions & 0 deletions diffhtwo/experimental/data_loaders/N_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
from collections import namedtuple

import jax.numpy as jnp
import numpy as np
from diffsky import diffndhist_lomem

from ..defaults import AppMagFunc, ColorColor, ColorCondMag, FeniksFilters, MagColor


def get_N_1d(dim1, dim1_bin_edges=None, dmag=0.2, sig_scale=0.5):
dataset = dim1.reshape(dim1.size, 1)
if dim1_bin_edges is None:
dim1_bin_edges = np.arange(dim1.min(), dim1.max(), dmag)

bin_lo = dim1_bin_edges[:-1].reshape(dim1_bin_edges[:-1].size, 1)
bin_hi = dim1_bin_edges[1:].reshape(dim1_bin_edges[1:].size, 1)

sig = jnp.zeros_like(bin_lo) + (dmag * sig_scale)

N_1d = diffndhist_lomem.tw_ndhist(
dataset,
sig,
bin_lo,
bin_hi,
)

return (
N_1d,
sig,
bin_lo,
bin_hi,
)


def get_N_2d(dim1, dim2, sig_scale=0.5):
dataset = np.vstack((dim1, dim2)).T

dim1_bin_edges = np.linspace(dim1.min(), dim1.max(), 11)
dim2_bin_edges = np.linspace(dim2.min(), dim2.max(), 11)

dim1_lo = dim1_bin_edges[:-1]
dim2_lo = dim2_bin_edges[:-1]
bin_lo = np.meshgrid(dim1_lo, dim2_lo, indexing="ij")
bin_lo = np.array(bin_lo).T.reshape(-1, 2)

dim1_hi = dim1_bin_edges[1:]
dim2_hi = dim2_bin_edges[1:]
bin_hi = np.meshgrid(dim1_hi, dim2_hi, indexing="ij")
bin_hi = np.array(bin_hi).T.reshape(-1, 2)

sig1 = np.diff(dim1_bin_edges) * sig_scale
sig2 = np.diff(dim2_bin_edges) * sig_scale
sig = np.meshgrid(sig1, sig2, indexing="ij")
sig = np.array(sig).T.reshape(-1, 2)

N_2d = diffndhist_lomem.tw_ndhist(
dataset,
sig,
bin_lo,
bin_hi,
)

return N_2d, sig, bin_lo, bin_hi


def filter_name_to_idx(filter_name):
return FeniksFilters._fields.index(filter_name)


def get_mag_space(namedtuple_name, mag, filter_name, z_sel, fit=True):
AppMagFuncSpace = namedtuple(namedtuple_name, AppMagFunc._fields)
mag_idx = filter_name_to_idx(filter_name)
N_1d, sig, bin_lo, bin_hi = get_N_1d(mag[z_sel])
return AppMagFuncSpace(mag_idx, sig, bin_lo, bin_hi, N_1d, fit)


def get_colorcolor_space(
namedtuple_name, color1, color2, col_filter_names, z_sel, fit=True
):
ColorColorSpace = namedtuple(namedtuple_name, ColorColor._fields)

N_2d, sig, bin_lo, bin_hi = get_N_2d(color1[z_sel], color2[z_sel])

col_idx = []
for n in col_filter_names:
col_idx.append(filter_name_to_idx(n))

return ColorColorSpace(col_idx, sig, bin_lo, bin_hi, N_2d, fit)


def get_color_cond_space_list(
namedtuple_name,
color,
cond_mag,
col_filter_names,
cond_filter_name,
z_sel,
cond_dmag=2,
fit=True,
):
ColorCondSpace = namedtuple(namedtuple_name, ColorCondMag._fields)

col_idx = []
for n in col_filter_names:
col_idx.append(filter_name_to_idx(n))
cond_idx = filter_name_to_idx(cond_filter_name)

cond_mag_bins = np.arange(cond_mag[z_sel].min(), cond_mag[z_sel].max(), cond_dmag)

color_cond_list = []
for b in range(len(cond_mag_bins) - 1):
cond_sel = (cond_mag[z_sel] > cond_mag_bins[b]) & (
cond_mag[z_sel] <= cond_mag_bins[b + 1]
)
N_1d, sig, bin_lo, bin_hi = get_N_1d(color[z_sel][cond_sel])
color_cond_list.append(
ColorCondSpace(
col_idx,
cond_idx,
cond_mag_bins[b],
cond_mag_bins[b + 1],
sig,
bin_lo,
bin_hi,
N_1d,
fit,
)
)

return color_cond_list


def get_mag_color_space(
namedtuple_name, mag, color, mag_filter_name, col_filter_names, z_sel, fit=True
):
MagColorSpace = namedtuple(namedtuple_name, MagColor._fields)

mag_idx = filter_name_to_idx(mag_filter_name)
col_idx = []
for n in col_filter_names:
col_idx.append(filter_name_to_idx(n))

N_2d, sig, bin_lo, bin_hi = get_N_2d(mag[z_sel], color[z_sel])

return MagColorSpace(mag_idx, col_idx, sig, bin_lo, bin_hi, N_2d, fit)
Loading
Loading