f890e8c3d52a41dc36b6ee3ba0871f31e73849bc,dipy/reconst/tests/test_shm.py,,test_anisotropic_power,#,423

Before Change


    assert_array_almost_equal(sh, sh2, 8)

def test_anisotropic_power():
    testset = np.array([[  2.52783730e-01,  -8.63827673e-03,  -1.76620393e-03,
         -4.34251390e-03,  -5.06066428e-03,   3.81412854e-03,
          5.47631094e-03,   1.39282880e-03,  -1.97130701e-03,
         -2.24682506e-03,  -1.53527315e-04,  -2.10712616e-03,
         -4.25627588e-03,  -1.17619725e-03,   4.01009840e-03,
         -6.47920358e-04,   8.22481678e-04,   8.23377092e-04,
         -7.11836682e-04,   2.82638114e-04,   1.46455538e-03,
         -4.38317576e-04,  -2.61096300e-03,  -1.00295214e-03,
          7.23340554e-04,  -5.83654797e-04,  -3.58804282e-04,
         -3.94789973e-04,  -2.07047830e-04,   5.64046556e-05,
          2.41292157e-04,  -2.90961130e-04,   2.97358074e-04,
          1.15252750e-04,  -1.28836328e-04,  -3.46523499e-04,
          6.22056608e-04,   6.52724346e-05,   3.37867643e-04,
         -1.78158269e-04,  -8.06460277e-04,  -1.61496289e-04,
          1.03801834e-04,  -4.04971608e-04,   4.06671521e-04],
       [  6.54906618e-01,   6.01605429e-02,  -1.29095193e-03,
         -5.98209383e-02,  -1.68493669e-02,   7.15610018e-03,
          5.75249662e-03,  -1.35418171e-03,  -1.00052805e-02,
         -4.87658886e-03,   1.17126517e-02,   2.43934596e-03,
         -3.81930503e-03,   2.04635341e-03,   2.15191399e-03,
          1.45180291e-03,  -2.14420615e-03,  -8.67168497e-04,
         -3.98567829e-04,   2.71038437e-03,   1.43256098e-03,
         -2.55735319e-03,  -1.22762066e-03,  -2.94671979e-04,
         -8.24539983e-04,  -1.91217995e-03,   2.92358998e-03,
          3.84784047e-04,   5.65364655e-04,  -1.52953294e-04,
         -7.69113245e-04,   7.86232204e-05,   4.28770877e-04,
         -3.84858162e-04,   3.16806826e-04,   3.69560911e-05,
         -3.77435401e-04,  -9.92549109e-04,   9.46511835e-05,
         -4.20370516e-05,  -3.49006474e-04,   7.59378701e-04,
         -1.29880688e-04,   4.27303338e-04,  -6.21976709e-04],
       [  1.89360240e+00,   1.87110413e-01,   3.58681307e-02,
         -9.84681046e-02,  -6.31403011e-03,  -3.29867297e-02,
          1.14994091e-02,  -3.92568546e-03,  -6.85004580e-03,
         -5.52995838e-03,   2.08796166e-03,  -7.30827851e-03,
          2.28580857e-03,  -7.06024059e-03,   3.55504738e-03,
          2.63670661e-03,   7.45926612e-04,  -3.49921955e-03,
          2.64668186e-03,  -2.11425877e-03,  -3.21175666e-03,
          2.15584339e-03,   1.52908205e-03,   6.50053432e-03,
          4.84225433e-03,   1.04335885e-03,   2.03526656e-03,
          3.24381403e-03,  -8.39235407e-04,   1.03430794e-03,
         -1.24813979e-03,  -8.71406267e-04,  -4.90323771e-04,
          5.53422314e-04,  -1.03307848e-03,  -8.26799601e-04,
         -1.04932393e-03,   1.02847598e-03,   1.72438048e-03,
          6.09002332e-05,  -2.35245883e-04,   1.33029383e-03,
          9.53928674e-04,   4.53461286e-04,  -8.50660289e-04]])

    answers = [0.0, 3.4198238120739317, 5.2417375088492255]

    apvals = anisotropic_power(testset)

After Change


            max_order = calculate_max_order(coeffs.shape[-1])
            // For the case where all coeffs == 1, the ap is simply log of the
            // number of even orders up to the maximal order:
            analytic = (np.log(len(range(2, max_order + 2, 2))) -
                        np.log(norm_factor))

            answers = [analytic] * 3
            apvals = anisotropic_power(coeffs, norm_factor=norm_factor)
            assert_array_almost_equal(apvals, answers)
            // Test that this works for single voxel arrays as well:
            assert_array_almost_equal(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: nipy/dipy
Commit Name: f890e8c3d52a41dc36b6ee3ba0871f31e73849bc
Time: 2015-10-19
Author: arokem@gmail.com
File Name: dipy/reconst/tests/test_shm.py
Class Name:
Method Name: test_anisotropic_power


Project Name: rusty1s/pytorch_geometric
Commit Name: 17aafdea24122bbb777f71a8ea7c2505e3fee84c
Time: 2019-03-15
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/models/autoencoder.py
Class Name: GAE
Method Name: reconstruction_loss


Project Name: MorvanZhou/tutorials
Commit Name: 447885e15243dd18d906e2e35ac34ec6dcf9a600
Time: 2016-12-30
Author: morvanzhou@hotmail.com
File Name: Reinforcement_learning_TUT/7_Policy_gradient/RL_brain.py
Class Name: PolicyGradient
Method Name: _build_net