memmapped_arange ignores the start value and drops the last point above the memmap threshold

Aperta Adatta ai principianti
#213 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@prathameshfuke ci sta già lavorando.

Dal 5/12/2026.

  • #214 di @prathameshfuke — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
numpy, python
Ambito
data

Direzione di ricerca

L’issue identifica hendrics.base.memmapped_arange e fornisce riproduzioni per il ramo con memoria mappata. Leggi quella funzione e confronta i suoi risultati con np.arange per i passi positivi e negativi indicati, compresi i casi in cui il passo non divide l’intervallo. Il lavoro è completato quando i risultati con memoria mappata corrispondono a np.arange per gli input segnalati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug
hendrics.base.memmapped_arange returns a different array from np.arange when it goes through the memory-mapped branch (Nbins >= nbin_threshold, 10**7 by default): the start i0 is ignored (the values always start from 0), and the length is truncated with int() where np.arange rounds up, so the last point can be lost. Below the threshold the function is just np.arange, so the docstring examples (which both start at 0 with a step that divides the range) do not show it. The function is used by HENaccelsearch to build the time axis (memmapped_arange(-0.5 * max_length, 1.5 * max_length, dt) with --pad-to-double), where a negative start is the normal case.

To Reproduce

import numpy as np
from hendrics.base import memmapped_arange

for args in [(1, 2, 0.25), (0, 10, 3), (5, 0, -1), (-1, 1, 0.5)]:
    print(args, np.arange(*args), np.asarray(memmapped_arange(*args, nbin_threshold=1)))
(1, 2, 0.25) [1.   1.25 1.5  1.75] [0.   0.25 0.5  0.75]
(0, 10, 3) [0 3 6 9] [0. 3. 6.]
(5, 0, -1) [5 4 3 2 1] [ 0. -1. -2. -3. -4.]
(-1, 1, 0.5) [-1.  -0.5  0.   0.5] [0.  0.5 1.  1.5]

Expected behavior
The same values as np.arange(i0, i1, istep).

Desktop

  • OS: macOS
  • Python version 3.12
  • HENDRICS Version: development from github (main)
Lingua principale
Jupyter Notebook
Stelle
26
Fork
18
Merge medio
1h 26m
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di StingraySoftware/HENDRICS

Tutte le issue di StingraySoftware/HENDRICS

Issue simili

Altre issue su Data Engineering

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.