Calculates the noise level (sigma_down) to step down to and the amount of noise to add (sigma_up) when doing an ancestral sampling step.
(sigma_from, sigma_to, eta=1.)
| 49 | |
| 50 | |
| 51 | def get_ancestral_step(sigma_from, sigma_to, eta=1.): |
| 52 | """Calculates the noise level (sigma_down) to step down to and the amount |
| 53 | of noise to add (sigma_up) when doing an ancestral sampling step.""" |
| 54 | if not eta: |
| 55 | return sigma_to, 0. |
| 56 | sigma_up = min(sigma_to, eta * (sigma_to ** 2 * (sigma_from ** 2 - sigma_to ** 2) / sigma_from ** 2) ** 0.5) |
| 57 | sigma_down = (sigma_to ** 2 - sigma_up ** 2) ** 0.5 |
| 58 | return sigma_down, sigma_up |
| 59 | |
| 60 | |
| 61 | def default_noise_sampler(x): |
no outgoing calls
no test coverage detected