31
|
|
|
Richard Lawrence |
15 years ago
|
|
|
30
|
|
|
Richard Lawrence |
15 years ago
|
|
|
29
|
|
|
Richard Lawrence |
15 years ago
|
|
|
28
|
|
|
Richard Lawrence |
15 years ago
|
|
|
27
|
|
Changed mnemonic.helpers.transitions functions to preserve output information. These functions now insert a "filler" value (default: numpy.NaN) into transitions arrays at positions where a transition is not calculated (e.g., where the from_pt is masked out).
This guarantees that the output of transitions() and the transitions array output by conditional_transitions() have a length equal to the number of items in the input from which a transition is computed (which is len(input) - step), and that the value at position i in the output is either the computed transition from input[i], or the filler.
For example, the previous behavior was: >>> data = array([4, 3, 2, 1, 5]) >>> mask = array([True, True, False, True, True]) >>> transitions(data, mask=mask) array([-1, 4]) # represents the transitions 4->3 and 1->5
Now, the result is: >>> transitions(data, mask=mask, filler=numpy.NaN) array([-1., NaN, NaN, 4.]) # shows that 3->2 and 2->1 were skipped
There is a lingering issue with types here, because inserting the filler directly is pretty much asking for a type explosion, but I haven't figured out how to sanity check it yet; the docstring just has a warning.
Changed docstrings and tests for transitions() and conditional_transitions().
|
Richard Lawrence |
15 years ago
|
|
|
26
|
|
|
Richard Lawrence |
15 years ago
|
|
|
25
|
|
|
Richard Lawrence |
15 years ago
|
|
|
24
|
|
|
Richard Lawrence |
15 years ago
|
|
|
23
|
|
|
Richard Lawrence |
15 years ago
|
|
|
22
|
|
|
Richard Lawrence |
15 years ago
|
|
|
21
|
|
|
Richard Lawrence |
15 years ago
|
|
|
20
|
|
|
Richard Lawrence |
15 years ago
|
|
|
19
|
|
|
Richard Lawrence |
15 years ago
|
|
|
18
|
|
|
Richard Lawrence |
15 years ago
|
|
|
17
|
|
|
Richard Lawrence |
15 years ago
|
|
|
16
|
|
|
Richard Lawrence |
15 years ago
|
|
|
15
|
|
|
Richard Lawrence |
15 years ago
|
|
|
14
|
|
|
Richard Lawrence |
15 years ago
|
|
|
13
|
|
|
Richard Lawrence |
15 years ago
|
|
|
12
|
|
|
Richard Lawrence |
15 years ago
|
|
|