BUG: setting a declared eccentricity back to None leaves the old distribution in place
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 74/100
Direzione di ricerca
Inizia da StochasticModel._declare_stochastic_input e da _reconfigure_stochastic_input, aggiunto in #1169; esamina come dict_generator utilizza le dichiarazioni stocastiche. Aggiungi test per un y omesso e per cancellare con None un x configurato in precedenza. Il lavoro è completo quando gli input omessi restano non dichiarati e quelli cancellati non ricompaiono dopo aver reimpostato il seed.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
add_cp_eccentricity and add_thrust_eccentricity accept None to mean an input is not randomized, and their docstrings document x and y as optional. Passing None after a distribution was configured does not remove the earlier one, so the next reseed brings it back.
stochastic = StochasticRocket(rocket=calisto, radius=0.0127 / 2)
stochastic.add_cp_eccentricity(x=0.001)
stochastic.add_cp_eccentricity(x=None)
stochastic._set_stochastic(7)
On develop at 7822ab1d:
after the None call, still declared: True
after the reseed, the attribute: (0, 0.001, Generator.normal)
in the generated dict: True
The caller asked for the uncertainty to go away and it is still being drawn.
Why
StochasticModel._declare_stochastic_input returns early on None rather than removing the entry:
if input_value is None:
return
self.__stochastic_dict[input_name] = input_value
dict_generator walks __stochastic_dict, so the stale declaration reaches the draw. The early return is right for the case it was written for, which is add_cp_eccentricity(x=0.001) with no y, where None means "was never given" rather than "take it away". The two meanings are not distinguished.
Fix
Removing the entry instead of returning early covers the second meaning, and leaves the first alone as long as removal only happens for a name that is being configured. #1169 adds _reconfigure_stochastic_input, which already owns the replacement half of this, so the removal fits there in about a line.
Worth a test for each meaning: add_cp_eccentricity(x=0.001) with no y must not declare y, and add_cp_eccentricity(x=None) after x=0.001 must remove x.
Where it came from
The behaviour arrived with #1167, which declared these inputs so a fixed seed could reproduce them. Reconfiguration was not part of that change. Raised separately rather than folded into #1169, which fixes the other half of the same lifecycle and is under review.
- Lingua principale
- Python
- Stelle
- 1.1k
- Fork
- 280
- Merge medio
- 3g 2h
- PR unite (30g)
- 24
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un 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 RocketPy-Team/RocketPy
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
RocketPy-Team/RocketPy#1255 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
RocketPy-Team/RocketPy#1241 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
RocketPy-Team/RocketPy#1202 ·
I maintainer di solito rispondono entro 3 giorni
-
Monte Carlo test fixtures write their logs into the working directoryForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
RocketPy-Team/RocketPy#1189 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 56/100
RocketPy-Team/RocketPy#1251 ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di RocketPy-Team/RocketPy
Issue simili
-
docs(contributing): the two things that silently block a PRForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaavailable documentation good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 95/100
Nixitov/Riptide-Native#944 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
JTHCode/secretguard#24 ·
I maintainer di solito rispondono entro 1 giorno
-
area: middleware documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
omarelshamy25x/shamy-hijri#63 ·
I maintainer di solito rispondono entro 1 giorno