HEN2xspec cannot handle Lomb-Scargle spectra
@aviralgarg05 ya está trabajando en esto.
Desde el 8/11/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Comienza en hendrics/save_as_xspec.py con el manejo de df, power_err y time_lag, y luego compara la rama de lag en hendrics/timelags.py. Comprueba hendrics/io.py:845 para entender el tipo de espectro cruzado Lomb-Scargle recargado. Se considera terminado cuando HEN2xspec procesa estos archivos con un comportamiento definido para la columna de errores y el lag, o los rechaza con un mensaje claro, manteniendo el manejo de entrada existente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
HENfspec --lombscargle produces LombScarglePowerspectrum / LombScargleCrossspectrum
objects. HEN2xspec accepts those files (get_file_type maps them to pds/cpds) but
cannot process them, because the Lomb-Scargle classes do not carry the attributes
save_as_xspec reads.
Reproduction
from stingray import Lightcurve
from stingray.lombscargle import LombScargleCrossspectrum
from hendrics.io import save_pds
from hendrics.save_as_xspec import save_as_xspec
# ... build lc1, lc2 ...
save_pds(LombScargleCrossspectrum(lc1, lc2), "ls_cpds.nc")
save_as_xspec("ls_cpds.nc")
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
Three separate causes
-
dfisNone.hendrics/save_as_xspec.py:37-38does
contents.freq - contents.df / 2. The Lomb-Scargle classes never setdf, in memory
or after a HENDRICS save/load round trip. This is the error above. -
power_errisNone. Line 41 (contents.power_err.real) fails next, for the same
reason. -
time_lag()returns a bare array, not a pair. Line 50 does
lags, lags_err = contents.time_lag(). That is correct for
AveragedCrossspectrum, which returns(lag, lag_err), but
Crossspectrum.time_lag()andLombScargleCrossspectrum.time_lag()return the lags
alone — there is no ensemble of segments to take an uncertainty from. Withdfand
power_errpatched in, this raisesValueError: too many values to unpack (expected 2).Note that
hendrics/io.py:845reconstructs a savedLombScargleCrossspectrumas a
plainCrossspectrum(it matches on the substring"Crossspectrum"), so the reloaded
object is in the no-error-bars branch either way.
HENlags already handles cause 3 correctly and works on these files.
Possible fix
- Derive
dffromnp.median(np.diff(freq))when it isNone. - Decide what to write in the error column when
power_erris absent — refuse with a
clear message, or write zeros, or compute something meaningful. - Guard the lag unpacking with
isinstance(lag, tuple), ashendrics/timelags.pydoes.
Alternatively, refuse Lomb-Scargle input in HEN2xspec with an explicit error message,
which is at least honest.
- Lenguaje dominante
- Jupyter Notebook
- Estrellas
- 26
- Forks
- 19
- Merge medio
- 1 h 26 min
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de StingraySoftware/HENDRICS
-
memmapped_arange ignores the start value and drops the last point above the memmap thresholdPosiblemente ocupada @prathameshfuke la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
StingraySoftware/HENDRICS#213 ·
-
Single-element arrays are read back as scalars from NetCDF filesPosiblemente ocupada @prathameshfuke la tomó hoy. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
StingraySoftware/HENDRICS#211 ·
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
StingraySoftware/HENDRICS#198 ·
-
tmp filesAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
StingraySoftware/HENDRICS#174 · 1 comentario ·
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
StingraySoftware/HENDRICS#155 ·
Todos los issues de StingraySoftware/HENDRICS
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Doist/todoist-cli#742 ·
-
cli
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
genealogix/glx#1634 · 1 reacción ·
Los mantenedores suelen responder en 2 días