Skip to content

Commit 4f96827

Browse files
committed
chore: clean-up tests and documentation
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: passed - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent 1fec441 commit 4f96827

12 files changed

Lines changed: 28 additions & 79 deletions

File tree

lib/node_modules/@stdlib/stats/base/dists/anglit/mean/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ limitations under the License.
2626

2727
<section class="intro">
2828

29-
The [mean][mean] of an [Anglit][anglit-distribution] random variable with location parameter `mu` and scale parameter `sigma` is
29+
The [mean][mean] of an [anglit][anglit-distribution] random variable with location parameter `mu` and scale parameter `sigma` is
3030

31-
<!-- <equation class="equation" label="eq:anglit_mean" align="center" raw="\mathbb{E}\left[ X \right] = \mu" alt="Mean for an Anglit distribution."> -->
31+
<!-- <equation class="equation" label="eq:anglit_mean" align="center" raw="\mathbb{E}\left[ X \right] = \mu" alt="Mean for an anglit distribution."> -->
3232

3333
```math
3434
\mathbb{E}\left[ X \right] = \mu
@@ -52,7 +52,7 @@ var mean = require( '@stdlib/stats/base/dists/anglit/mean' );
5252

5353
#### mean( mu, sigma )
5454

55-
Returns the [expected value][mean] of an [Anglit][anglit-distribution] distribution with location parameter `mu` and scale parameter `sigma`.
55+
Returns the [expected value][mean] of an [anglit][anglit-distribution] distribution with location parameter `mu` and scale parameter `sigma`.
5656

5757
```javascript
5858
var y = mean( 2.0, 1.0 );
@@ -151,7 +151,7 @@ logEachMap( 'µ: %lf, σ: %lf, E(X;µ,σ): %lf', mu, sigma, mean );
151151

152152
#### stdlib_base_dists_anglit_mean( mu, sigma )
153153

154-
Returns the [expected value][mean] of an [Anglit][anglit-distribution] distribution with location parameter `mu` and scale parameter `sigma`.
154+
Returns the [expected value][mean] of an [anglit][anglit-distribution] distribution with location parameter `mu` and scale parameter `sigma`.
155155

156156
```c
157157
double out = stdlib_base_dists_anglit_mean( 2.0, 1.0 );

lib/node_modules/@stdlib/stats/base/dists/anglit/mean/docs/repl.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
{{alias}}( μ, σ )
3-
Returns the expected value of an Anglit distribution with location
4-
parameter `μ` and scale parameter `σ`.
3+
Returns the expected value of an anglit distribution with location parameter
4+
`μ` and scale parameter `σ`.
55

66
If provided `NaN` as any argument, the function returns `NaN`.
77

lib/node_modules/@stdlib/stats/base/dists/anglit/mean/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// TypeScript Version: 4.1
2020

2121
/**
22-
* Returns the expected value of an Anglit distribution with location parameter `mu` and scale parameter `sigma`.
22+
* Returns the expected value of an anglit distribution with location parameter `mu` and scale parameter `sigma`.
2323
*
2424
* ## Notes
2525
*

lib/node_modules/@stdlib/stats/base/dists/anglit/mean/include/stdlib/stats/base/dists/anglit/mean.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C" {
2727
#endif
2828

2929
/**
30-
* Evaluates the expected value of an Anglit distribution with location parameter `mu` and scale parameter `sigma`.
30+
* Evaluates the expected value of an anglit distribution with location parameter `mu` and scale parameter `sigma`.
3131
*/
3232
double stdlib_base_dists_anglit_mean( const double mu, const double sigma );
3333

lib/node_modules/@stdlib/stats/base/dists/anglit/mean/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
// MAIN //
2727

2828
/**
29-
* Returns the expected value of an Anglit distribution with location parameter `mu` and scale parameter `sigma`.
29+
* Returns the expected value of an anglit distribution with location parameter `mu` and scale parameter `sigma`.
3030
*
3131
* @param {number} mu - location parameter
3232
* @param {PositiveNumber} sigma - scale parameter

lib/node_modules/@stdlib/stats/base/dists/anglit/mean/lib/native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var addon = require( './../src/addon.node' );
2626
// MAIN //
2727

2828
/**
29-
* Returns the expected value of an Anglit distribution with location parameter `mu` and scale parameter `sigma`.
29+
* Returns the expected value of an anglit distribution with location parameter `mu` and scale parameter `sigma`.
3030
*
3131
* @private
3232
* @param {number} mu - location parameter

lib/node_modules/@stdlib/stats/base/dists/anglit/mean/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "stdlib/math/base/assert/is_nan.h"
2121

2222
/**
23-
* Returns the expected value of an Anglit distribution with location parameter `mu` and scale parameter `sigma`.
23+
* Returns the expected value of an anglit distribution with location parameter `mu` and scale parameter `sigma`.
2424
*
2525
* @param mu location parameter
2626
* @param sigma scale parameter

lib/node_modules/@stdlib/stats/base/dists/anglit/mean/test/test.js

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
var tape = require( 'tape' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
25-
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
2625
var PINF = require( '@stdlib/constants/float64/pinf' );
2726
var NINF = require( '@stdlib/constants/float64/ninf' );
2827
var mean = require( './../lib' );
@@ -77,7 +76,7 @@ tape( 'if provided a nonpositive `sigma`, the function returns `NaN`', function
7776
t.end();
7877
});
7978

80-
tape( 'the function returns the expected value of an Anglit distribution', function test( t ) {
79+
tape( 'the function returns the expected value of an anglit distribution', function test( t ) {
8180
var expected;
8281
var sigma;
8382
var mu;
@@ -89,11 +88,7 @@ tape( 'the function returns the expected value of an Anglit distribution', funct
8988
sigma = data.sigma;
9089
for ( i = 0; i < mu.length; i++ ) {
9190
y = mean( mu[i], sigma[i] );
92-
if ( y === expected[i] ) {
93-
t.strictEqual( y, expected[i], 'mu:'+mu[i]+', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] );
94-
} else {
95-
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'within tolerance. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
96-
}
91+
t.strictEqual( y, expected[i], 'returns expected value' );
9792
}
9893
t.end();
9994
});
@@ -110,11 +105,7 @@ tape( 'the function returns the expected value for small `mu` values', function
110105
sigma = smallMu.sigma;
111106
for ( i = 0; i < mu.length; i++ ) {
112107
y = mean( mu[i], sigma[i] );
113-
if ( y === expected[i] ) {
114-
t.strictEqual( y, expected[i], 'mu:'+mu[i]+', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] );
115-
} else {
116-
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'within tolerance. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
117-
}
108+
t.strictEqual( y, expected[i], 'returns expected value' );
118109
}
119110
t.end();
120111
});
@@ -131,11 +122,7 @@ tape( 'the function returns the expected value for large `mu` values', function
131122
sigma = largeMu.sigma;
132123
for ( i = 0; i < mu.length; i++ ) {
133124
y = mean( mu[i], sigma[i] );
134-
if ( y === expected[i] ) {
135-
t.strictEqual( y, expected[i], 'mu:'+mu[i]+', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] );
136-
} else {
137-
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'within tolerance. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
138-
}
125+
t.strictEqual( y, expected[i], 'returns expected value' );
139126
}
140127
t.end();
141128
});
@@ -152,11 +139,7 @@ tape( 'the function returns the expected value for small `sigma` values', functi
152139
sigma = smallSigma.sigma;
153140
for ( i = 0; i < mu.length; i++ ) {
154141
y = mean( mu[i], sigma[i] );
155-
if ( y === expected[i] ) {
156-
t.strictEqual( y, expected[i], 'mu:'+mu[i]+', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] );
157-
} else {
158-
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'within tolerance. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
159-
}
142+
t.strictEqual( y, expected[i], 'returns expected value' );
160143
}
161144
t.end();
162145
});
@@ -173,11 +156,7 @@ tape( 'the function returns the expected value for large `sigma` values', functi
173156
sigma = largeSigma.sigma;
174157
for ( i = 0; i < mu.length; i++ ) {
175158
y = mean( mu[i], sigma[i] );
176-
if ( y === expected[i] ) {
177-
t.strictEqual( y, expected[i], 'mu:'+mu[i]+', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] );
178-
} else {
179-
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'within tolerance. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
180-
}
159+
t.strictEqual( y, expected[i], 'returns expected value' );
181160
}
182161
t.end();
183162
});

lib/node_modules/@stdlib/stats/base/dists/anglit/mean/test/test.native.js

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ var resolve = require( 'path' ).resolve;
2424
var tape = require( 'tape' );
2525
var tryRequire = require( '@stdlib/utils/try-require' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
27-
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
2827
var PINF = require( '@stdlib/constants/float64/pinf' );
2928
var NINF = require( '@stdlib/constants/float64/ninf' );
3029

@@ -85,7 +84,7 @@ tape( 'if provided `sigma <= 0.0`, the function returns `NaN`', opts, function t
8584
t.end();
8685
});
8786

88-
tape( 'the function returns the expected value of an Anglit distribution', opts, function test( t ) {
87+
tape( 'the function returns the expected value of an anglit distribution', opts, function test( t ) {
8988
var expected;
9089
var sigma;
9190
var mu;
@@ -97,11 +96,7 @@ tape( 'the function returns the expected value of an Anglit distribution', opts,
9796
sigma = data.sigma;
9897
for ( i = 0; i < mu.length; i++ ) {
9998
y = mean( mu[i], sigma[i] );
100-
if ( y === expected[i] ) {
101-
t.strictEqual( y, expected[i], 'mu:'+mu[i]+', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] );
102-
} else {
103-
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'within tolerance. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
104-
}
99+
t.strictEqual( y, expected[i], 'returns expected value' );
105100
}
106101
t.end();
107102
});
@@ -118,11 +113,7 @@ tape( 'the function returns the expected value for small `mu` values', opts, fun
118113
sigma = smallMu.sigma;
119114
for ( i = 0; i < mu.length; i++ ) {
120115
y = mean( mu[i], sigma[i] );
121-
if ( y === expected[i] ) {
122-
t.strictEqual( y, expected[i], 'mu:'+mu[i]+', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] );
123-
} else {
124-
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'within tolerance. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
125-
}
116+
t.strictEqual( y, expected[i], 'returns expected value' );
126117
}
127118
t.end();
128119
});
@@ -139,11 +130,7 @@ tape( 'the function returns the expected value for large `mu` values', opts, fun
139130
sigma = largeMu.sigma;
140131
for ( i = 0; i < mu.length; i++ ) {
141132
y = mean( mu[i], sigma[i] );
142-
if ( y === expected[i] ) {
143-
t.strictEqual( y, expected[i], 'mu:'+mu[i]+', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] );
144-
} else {
145-
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'within tolerance. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
146-
}
133+
t.strictEqual( y, expected[i], 'returns expected value' );
147134
}
148135
t.end();
149136
});
@@ -160,11 +147,7 @@ tape( 'the function returns the expected value for small `sigma` values', opts,
160147
sigma = smallSigma.sigma;
161148
for ( i = 0; i < mu.length; i++ ) {
162149
y = mean( mu[i], sigma[i] );
163-
if ( y === expected[i] ) {
164-
t.strictEqual( y, expected[i], 'mu:'+mu[i]+', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] );
165-
} else {
166-
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'within tolerance. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
167-
}
150+
t.strictEqual( y, expected[i], 'returns expected value' );
168151
}
169152
t.end();
170153
});
@@ -181,11 +164,7 @@ tape( 'the function returns the expected value for large `sigma` values', opts,
181164
sigma = largeSigma.sigma;
182165
for ( i = 0; i < mu.length; i++ ) {
183166
y = mean( mu[i], sigma[i] );
184-
if ( y === expected[i] ) {
185-
t.strictEqual( y, expected[i], 'mu:'+mu[i]+', sigma: '+sigma[i]+', y: '+y+', expected: '+expected[i] );
186-
} else {
187-
t.strictEqual( isAlmostSameValue( y, expected[i], 1 ), true, 'within tolerance. mu: '+mu[i]+'. sigma: '+sigma[i]+'. y: '+y+'. E: '+expected[ i ]+'.' );
188-
}
167+
t.strictEqual( y, expected[i], 'returns expected value' );
189168
}
190169
t.end();
191170
});

lib/node_modules/@stdlib/stats/base/dists/anglit/median/test/fixtures/python/runner.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def gen(loc, sigma, name):
4848
```
4949
"""
5050
z = np.array(anglit.median(loc=loc, scale=sigma))
51+
5152
# Canonicalize values to the analytic median (loc) when numerically close.
5253
z = np.where(np.isclose(z, loc), loc, z)
5354

@@ -72,8 +73,8 @@ def gen(loc, sigma, name):
7273

7374
def main():
7475
"""Generate fixture data."""
75-
loc = np.random.rand(100) * 10.0 - 5.0
76-
sigma = np.random.rand(100) * 5.0 + 0.01
76+
loc = (np.random.rand(100) * 10.0) - 5.0
77+
sigma = (np.random.rand(100) * 5.0) + 0.01
7778
gen(loc, sigma, "data.json")
7879

7980

0 commit comments

Comments
 (0)