Inconsistent behaviour of tstart and tseg after using lc.truncate
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Reproduce los ejemplos proporcionados de GTI y no-GTI y, a continuación, inspecciona el método truncate en base.py, especialmente las asignaciones a new_ts.tstart y new_ts.tseg. Compara los valores truncados con el array de tiempo actualizado y dt en ambos casos. La tarea estará terminada cuando tstart y tseg se comporten de forma coherente antes y después del truncado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description of the Bug
If a lightcurve with a gti is truncated, tstart and tseg behave inconsistently before and after the truncation. Prior to truncation, both are defined based on the times and dt e.g. tstart is defined in the usual way time[0] - dt/2.
After truncating tstart is defined by the first GTI starting time and tseg (incorrectly) based on the gti first and last times. I would have reopened #751 but I don't have privileges.
In truncate method of base.py, I don't think this is correct:
new_ts.tstart = new_ts.gti[0, 0]
new_ts.tseg = new_ts.gti[-1, 1] - new_ts.gti[0, 0]
I think the new tstart and tseg should be defined based on the updated times, unless I'm missing something. If we agree on that I could try to fix it myself.
Steps/Code to Replicate the Bug
from stingray import Lightcurve
import numpy as np
times = np.arange(50)
mean_flux = 100.0
std_flux = 2.0
flux = np.random.normal(loc=mean_flux, scale=std_flux, size=len(times))
flux_err = np.ones_like(flux) * std_flux
lc = Lightcurve(times, flux, err=flux_err, err_dist="None", dt=1.0, skip_checks=True)
# No GTI
lc = Lightcurve(times, flux, err=flux_err, err_dist="None", dt=1.0, skip_checks=True)
print("No GTI\n=====")
print("Tstart before truncating", lc.tstart)
print("Tseg before truncating", lc.tseg)
newlc = lc.truncate(10, method="time")
print("Tstart after truncating", newlc.tstart)
print("Tstart after truncating", newlc.tseg)
# GTI
gti = [[25, 30], [40, 45]]
lc = Lightcurve(times, flux, err=flux_err, gti=gti, err_dist="None", dt=1.0, skip_checks=True)
print("GTI\n=====")
print("Tstart before truncating", lc.tstart)
print("Tseg tefore truncating", lc.tseg)
newlc = lc.truncate(10, method="time")
print("Tstart after truncating", newlc.tstart)
print("Tseg after truncating", newlc.tseg)
Expected Results
tstart should be defined consistently throughout, as lc.time[0] - lc.dt/2 I would say.
Same thing for tseg, which should be defined based on lc.time and lc.dt and not on the gti.
Actual Results
No GTI
Tstart before truncating -0.5
Tseg before truncating 50.0
Tstart after truncating 9.5
Tstart after truncating 40.0
GTI
Tstart before truncating -0.5
Tseg tefore truncating 50.0
Tstart after truncating 25.0
Tseg after truncating 20.0
- Lenguaje dominante
- Python
- Estrellas
- 229
- Forks
- 196
- Merge medio
- 4 d 12 h
- PR fusionados (30 d)
- 20
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una 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/stingray
-
create_gti_mask drops valid points after empty GTIs and crashes with min_length > 0 and dtPosiblemente ocupada @Rohan-Dedhia la tomó hace 5 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
StingraySoftware/stingray#1044 ·
Los mantenedores suelen responder en 3 días
-
Docstrings that name parameters the function does not take: full list, categorised (25 sites)Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
StingraySoftware/stingray#1042 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
StingraySoftware/stingray#1039 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
stingray: arbitrary code execution reading a pickle-format data product (read fmt=pickle) (CWE-502)Quizá libre de nuevo @yash-8923 la tomó hace 11 días y no hay ningún pull request abierto. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
StingraySoftware/stingray#1037 · 3 comentarios ·
Los mantenedores suelen responder en 3 días
-
AveragedCrossspectrum returns zeros when using simulated light curves with input_counts=False.Posiblemente ocupada @VrtxOmega la tomó hace 176 días. Abiertobug help wanted
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
StingraySoftware/stingray#977 · 1 comentario ·
Los mantenedores suelen responder en 3 días
Todos los issues de StingraySoftware/stingray
Issues similares
-
Public benchmark import end-to-end test fails when the test stack's worker runs the parity jobAbiertoaccepted
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
future-agi/future-agi#6392 ·
Los mantenedores suelen responder en 1 día
-
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 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
bot-triaged module: decompositions module: edge cases module: int overflow module: primTorch oncall: pt2 triage review
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día