How to use the kymatio.scattering3d.utils.compute_integrals function in kymatio

To help you get started, we’ve selected a few kymatio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kymatio / kymatio / examples / 3d / scattering3d_qm7.py View on Github external
int((((n_batches - i - 1) * dt) // 60) % 60),
                        int(((n_batches - i - 1) * dt) % 60)), end='\r')
        else:
            print("Iteration {} ETA: {}".format(i + 1,'-'),end='\r')
        last_time = this_time
        time.sleep(1)

        start, end = i * batch_size, min((i + 1) * batch_size, n_molecules)

        pos_batch = pos[start:end]
        full_batch = full_charges[start:end]
        val_batch = valence_charges[start:end]

        full_density_batch = generate_weighted_sum_of_gaussians(
                grid, pos_batch, full_batch, sigma, cuda=cuda)
        full_order_0 = compute_integrals(full_density_batch, integral_powers)
        scattering.max_order = 2
        scattering.method = 'integral'
        scattering.integral_powers = integral_powers
        full_scattering = scattering(full_density_batch)

        val_density_batch = generate_weighted_sum_of_gaussians(
                grid, pos_batch, val_batch, sigma, cuda=cuda)
        val_order_0 = compute_integrals(val_density_batch, integral_powers)
        val_scattering= scattering(val_density_batch)

        core_density_batch = full_density_batch - val_density_batch
        core_order_0 = compute_integrals(core_density_batch, integral_powers)
        core_scattering = scattering(core_density_batch)


        order_0.append(
github kymatio / kymatio / examples / 3d / scattering3d_qm7.py View on Github external
full_density_batch = generate_weighted_sum_of_gaussians(
                grid, pos_batch, full_batch, sigma, cuda=cuda)
        full_order_0 = compute_integrals(full_density_batch, integral_powers)
        scattering.max_order = 2
        scattering.method = 'integral'
        scattering.integral_powers = integral_powers
        full_scattering = scattering(full_density_batch)

        val_density_batch = generate_weighted_sum_of_gaussians(
                grid, pos_batch, val_batch, sigma, cuda=cuda)
        val_order_0 = compute_integrals(val_density_batch, integral_powers)
        val_scattering= scattering(val_density_batch)

        core_density_batch = full_density_batch - val_density_batch
        core_order_0 = compute_integrals(core_density_batch, integral_powers)
        core_scattering = scattering(core_density_batch)


        order_0.append(
            torch.stack([full_order_0, val_order_0, core_order_0], dim=-1))
        orders_1_and_2.append(
            torch.stack(
                [full_scattering, val_scattering, core_scattering], dim=-1))

    order_0 = torch.cat(order_0, dim=0)
    orders_1_and_2 = torch.cat(orders_1_and_2, dim=0)

    return order_0, orders_1_and_2
github kymatio / kymatio / examples / 3d / scattering3d_qm7.py View on Github external
pos_batch = pos[start:end]
        full_batch = full_charges[start:end]
        val_batch = valence_charges[start:end]

        full_density_batch = generate_weighted_sum_of_gaussians(
                grid, pos_batch, full_batch, sigma, cuda=cuda)
        full_order_0 = compute_integrals(full_density_batch, integral_powers)
        scattering.max_order = 2
        scattering.method = 'integral'
        scattering.integral_powers = integral_powers
        full_scattering = scattering(full_density_batch)

        val_density_batch = generate_weighted_sum_of_gaussians(
                grid, pos_batch, val_batch, sigma, cuda=cuda)
        val_order_0 = compute_integrals(val_density_batch, integral_powers)
        val_scattering= scattering(val_density_batch)

        core_density_batch = full_density_batch - val_density_batch
        core_order_0 = compute_integrals(core_density_batch, integral_powers)
        core_scattering = scattering(core_density_batch)


        order_0.append(
            torch.stack([full_order_0, val_order_0, core_order_0], dim=-1))
        orders_1_and_2.append(
            torch.stack(
                [full_scattering, val_scattering, core_scattering], dim=-1))

    order_0 = torch.cat(order_0, dim=0)
    orders_1_and_2 = torch.cat(orders_1_and_2, dim=0)
github kymatio / kymatio / kymatio / scattering3d / scattering3d.py View on Github external
a torch tensor of size (batchsize, number of points, 3) the points in
            coordinate space at which you want the moduli sampled
        j : int
            lowpass scale j of :math:`\\phi_j`

        Returns
        -------
        output: torch tensor 
            The scattering coefficients as given by different methods.

        """
        methods = ['standard', 'local', 'integral']
        if (not method in methods):
            raise(ValueError('method must be in {}'.format(methods)))
        if method == 'integral':
            return compute_integrals(input_array[..., 0],
                                     args['integral_powers'])
        elif method == 'local':
            return self._compute_local_scattering_coefs(input_array,
                                                        args['points'], j)
        elif method == 'standard':
            return self._compute_standard_scattering_coefs(input_array)