def scale_dust(freq0, freq1, ref_freq, beta, delta_beta=None, deriv=False):
    '\n    Get the factor by which you must multiply the cross spectrum from maps of\n    frequencies freq0 and freq1 to match the dust power at ref_freq given\n    spectra index beta.\n\n    If deriv is True, return the frequency scaling at the reference beta,\n    and the first derivative w.r.t. beta.\n\n    Otherwise if delta_beta is given, return the scale factor adjusted\n    for a linearized offset delta_beta from the reference beta.\n\n    Arguments\n    ---------\n    freq0 : float\n        Frequency of map0 in GHz.\n    freq1 : float\n        Frequency of map1 in GHz.\n    ref_freq : float\n        Reference frequency from which to compute relative scaling in GHz.\n    beta : float\n        Dust spectral index.\n    delta_beta : float\n        Difference from beta-- scaling computed as a first order Taylor\n        expansion from original beta-scaling.\n    deriv : bool\n        If true, return the frequency scaling at the reference beta, along with\n        the first derivative w.r.t. beta at the reference beta.\n\n    Returns\n    -------\n    freq_scale : float\n        The relative scaling factor for the dust cross spectrum-- multiply by\n        this number to get the dust spectrum at the reference frequency\n    -- or --\n    freq_scale, deriv : floats\n        The relative scaling factor and its derivative\n    '
    freq_scale = (((((rj2cmb(freq0) * rj2cmb(freq1)) / (rj2cmb(ref_freq) ** 2.0)) * blackbody(freq0, ref_freq=ref_freq)) * blackbody(freq1, ref_freq=ref_freq)) * (((freq0 * freq1) / (ref_freq ** 2)) ** (beta - 2.0)))
    if (deriv or (delta_beta is not None)):
        delta = np.log(((freq0 * freq1) / (ref_freq ** 2)))
        if deriv:
            return (freq_scale, (freq_scale * delta))
        return (freq_scale * (1 + (delta * delta_beta)))
    return freq_scale
Get the factor by which you must multiply the cross spectrum from maps of
frequencies freq0 and freq1 to match the dust power at ref_freq given
spectra index beta.

If deriv is True, return the frequency scaling at the reference beta,
and the first derivative w.r.t. beta.

Otherwise if delta_beta is given, return the scale factor adjusted
for a linearized offset delta_beta from the reference beta.

Arguments
---------
freq0 : float
    Frequency of map0 in GHz.
freq1 : float
    Frequency of map1 in GHz.
ref_freq : float
    Reference frequency from which to compute relative scaling in GHz.
beta : float
    Dust spectral index.
delta_beta : float
    Difference from beta-- scaling computed as a first order Taylor
    expansion from original beta-scaling.
deriv : bool
    If true, return the frequency scaling at the reference beta, along with
    the first derivative w.r.t. beta at the reference beta.

Returns
-------
freq_scale : float
    The relative scaling factor for the dust cross spectrum-- multiply by
    this number to get the dust spectrum at the reference frequency
-- or --
freq_scale, deriv : floats
    The relative scaling factor and its derivative
def scale_dust(freq0, freq1, ref_freq, beta, delta_beta=None, deriv=False):
    '\n    Get the factor by which you must multiply the cross spectrum from maps of\n    frequencies freq0 and freq1 to match the dust power at ref_freq given\n    spectra index beta.\n\n    If deriv is True, return the frequency scaling at the reference beta,\n    and the first derivative w.r.t. beta.\n\n    Otherwise if delta_beta is given, return the scale factor adjusted\n    for a linearized offset delta_beta from the reference beta.\n\n    Arguments\n    ---------\n    freq0 : float\n        Frequency of map0 in GHz.\n    freq1 : float\n        Frequency of map1 in GHz.\n    ref_freq : float\n        Reference frequency from which to compute relative scaling in GHz.\n    beta : float\n        Dust spectral index.\n    delta_beta : float\n        Difference from beta-- scaling computed as a first order Taylor\n        expansion from original beta-scaling.\n    deriv : bool\n        If true, return the frequency scaling at the reference beta, along with\n        the first derivative w.r.t. beta at the reference beta.\n\n    Returns\n    -------\n    freq_scale : float\n        The relative scaling factor for the dust cross spectrum-- multiply by\n        this number to get the dust spectrum at the reference frequency\n    -- or --\n    freq_scale, deriv : floats\n        The relative scaling factor and its derivative\n    '
    freq_scale = (((((rj2cmb(freq0) * rj2cmb(freq1)) / (rj2cmb(ref_freq) ** 2.0)) * blackbody(freq0, ref_freq=ref_freq)) * blackbody(freq1, ref_freq=ref_freq)) * (((freq0 * freq1) / (ref_freq ** 2)) ** (beta - 2.0)))
    if (deriv or (delta_beta is not None)):
        delta = np.log(((freq0 * freq1) / (ref_freq ** 2)))
        if deriv:
            return (freq_scale, (freq_scale * delta))
        return (freq_scale * (1 + (delta * delta_beta)))
    return freq_scale