code: def get_ancestral_step(sigma_from, sigma_to, eta=1.0):
      """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.
      """
      if not eta:
          return sigma_to, 0.0
      sigma_up = min(
          sigma_to,
          eta
          * (
              sigma_to**2
              * (sigma_from**2 - sigma_to**2)
              / sigma_from**2
          )
          ** 0.5,
      )
      sigma_down = (sigma_to**2 - sigma_up**2) ** 0.5
      return sigma_down, sigma_up
  
imports: import math
  import torch
  import torchsde
  from scipy import integrate
  from torch import nn
  from torchdiffeq import odeint
  from tqdm.auto import tqdm, trange
label_desc: Use image node_id 8 for calling a global function with example usage: get_ancestral_step(sigma_from, sigma_to, eta) and returns: sigma_down,  sigma_up, sigma_to,  int