memmapped_arange ignores the start value and drops the last point above the memmap threshold
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
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
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di StingraySoftware/HENDRICS
-
Single-element arrays are read back as scalars from NetCDF filesForse già presa @prathameshfuke l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
StingraySoftware/HENDRICS#211 ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
StingraySoftware/HENDRICS#198 ·
-
HEN2xspec cannot handle Lomb-Scargle spectraForse di nuovo libera @aviralgarg05 l’ha presa 26 giorni fa e non c’è nessuna pull request aperta. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
StingraySoftware/HENDRICS#197 · 1 commento ·
-
tmp filesAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
StingraySoftware/HENDRICS#174 · 1 commento ·
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
StingraySoftware/HENDRICS#155 ·
Tutte le issue di StingraySoftware/HENDRICS
Issue simili
-
[TV SHOW]: Dynasty (1981)Apertacountry:US rating:6 request-theme type:TV SHOW
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
LizardByte/ThemerrDB#10501 · 1 commento ·
-
triage/confirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
agentscope-ai/agentscope#4563 ·
I maintainer di solito rispondono entro 2 giorni
-
Split part lines show the bare category name, ordinary booking lines show the full category pathApertabugfix
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
GiroCrab/GiroCrab#2528 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
approved correction metadata
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
acl-org/acl-anthology#11237 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
#1643 unrecoverable split: 1 digest with a 403 — two earlier captures of the same URL are real 200sAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
Robin-IA/Congressional-Letters-Dev#1684 ·
I maintainer di solito rispondono entro 1 giorno