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.)
| 54 | |
| 55 | |
| 56 | def get_ancestral_step(sigma_from, sigma_to, eta=1.): |
| 57 | """Calculates the noise level (sigma_down) to step down to and the amount |
| 58 | of noise to add (sigma_up) when doing an ancestral sampling step.""" |
| 59 | if not eta: |
| 60 | return sigma_to, 0. |
| 61 | sigma_up = min(sigma_to, eta * (sigma_to ** 2 * (sigma_from ** 2 - sigma_to ** 2) / sigma_from ** 2) ** 0.5) |
| 62 | sigma_down = (sigma_to ** 2 - sigma_up ** 2) ** 0.5 |
| 63 | return sigma_down, sigma_up |
| 64 | |
| 65 | |
| 66 | def default_noise_sampler(x): |
no outgoing calls
no test coverage detected