body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
d3554e43f4268815e372f8e942ec8a792b553cff9e485c8abc329a22de3ab8ae
def __setstate__(self, state): '\n In order to maintain backwards compatibility and be able to unpickle a\n old pickle from ``Composition_class`` we have to override the default\n ``__setstate__``.\n\n EXAMPLES::\n\n sage: loads(b"x\\x9ck`J.NLO\\xd5K\\xce\\xcfM\\xca\\xccK,\\x0...
In order to maintain backwards compatibility and be able to unpickle a old pickle from ``Composition_class`` we have to override the default ``__setstate__``. EXAMPLES:: sage: loads(b"x\x9ck`J.NLO\xd5K\xce\xcfM\xca\xccK,\x011\n\xf2\x8b3K2\xf3\xf3\xb8\x9c\x11\xec\xf8\xe4\x9c\xc4\xe2b\xaeBF\xcd\xc6B\xa6\xdaBf\x8dP\...
src/sage/combinat/composition.py
__setstate__
LaisRast/sage
1,742
python
def __setstate__(self, state): '\n In order to maintain backwards compatibility and be able to unpickle a\n old pickle from ``Composition_class`` we have to override the default\n ``__setstate__``.\n\n EXAMPLES::\n\n sage: loads(b"x\\x9ck`J.NLO\\xd5K\\xce\\xcfM\\xca\\xccK,\\x0...
def __setstate__(self, state): '\n In order to maintain backwards compatibility and be able to unpickle a\n old pickle from ``Composition_class`` we have to override the default\n ``__setstate__``.\n\n EXAMPLES::\n\n sage: loads(b"x\\x9ck`J.NLO\\xd5K\\xce\\xcfM\\xca\\xccK,\\x0...
33fa7a4db1f431f6976c71aed0093adca7f37b868297d526618b9613edbeac46
@combinatorial_map(order=2, name='conjugate') def conjugate(self) -> Composition: '\n Return the conjugate of the composition ``self``.\n\n The conjugate of a composition `I` is defined as the\n complement (see :meth:`complement`) of the reverse composition\n (see :meth:`reversed`) of `I...
Return the conjugate of the composition ``self``. The conjugate of a composition `I` is defined as the complement (see :meth:`complement`) of the reverse composition (see :meth:`reversed`) of `I`. An equivalent definition of the conjugate goes by saying that the ribbon shape of the conjugate of a composition `I` is t...
src/sage/combinat/composition.py
conjugate
LaisRast/sage
1,742
python
@combinatorial_map(order=2, name='conjugate') def conjugate(self) -> Composition: '\n Return the conjugate of the composition ``self``.\n\n The conjugate of a composition `I` is defined as the\n complement (see :meth:`complement`) of the reverse composition\n (see :meth:`reversed`) of `I...
@combinatorial_map(order=2, name='conjugate') def conjugate(self) -> Composition: '\n Return the conjugate of the composition ``self``.\n\n The conjugate of a composition `I` is defined as the\n complement (see :meth:`complement`) of the reverse composition\n (see :meth:`reversed`) of `I...
df92c5efc116f5601dae237f026eee9ca2975a7e23b6c784996e5c672ba342f5
@combinatorial_map(order=2, name='reversed') def reversed(self) -> Composition: '\n Return the reverse composition of ``self``.\n\n The reverse composition of a composition `(i_1, i_2, \\ldots, i_k)`\n is defined as the composition `(i_k, i_{k-1}, \\ldots, i_1)`.\n\n EXAMPLES::\n\n ...
Return the reverse composition of ``self``. The reverse composition of a composition `(i_1, i_2, \ldots, i_k)` is defined as the composition `(i_k, i_{k-1}, \ldots, i_1)`. EXAMPLES:: sage: Composition([1, 1, 3, 1, 2, 1, 3]).reversed() [3, 1, 2, 1, 3, 1, 1]
src/sage/combinat/composition.py
reversed
LaisRast/sage
1,742
python
@combinatorial_map(order=2, name='reversed') def reversed(self) -> Composition: '\n Return the reverse composition of ``self``.\n\n The reverse composition of a composition `(i_1, i_2, \\ldots, i_k)`\n is defined as the composition `(i_k, i_{k-1}, \\ldots, i_1)`.\n\n EXAMPLES::\n\n ...
@combinatorial_map(order=2, name='reversed') def reversed(self) -> Composition: '\n Return the reverse composition of ``self``.\n\n The reverse composition of a composition `(i_1, i_2, \\ldots, i_k)`\n is defined as the composition `(i_k, i_{k-1}, \\ldots, i_1)`.\n\n EXAMPLES::\n\n ...
1870a71b537c349b2086adf1f9c0bb3dbe1c7a96c28974708df5e67f05fed148
@combinatorial_map(order=2, name='complement') def complement(self) -> Composition: '\n Return the complement of the composition ``self``.\n\n The complement of a composition `I` is defined as follows:\n\n If `I` is the empty composition, then the complement is the empty\n composition as...
Return the complement of the composition ``self``. The complement of a composition `I` is defined as follows: If `I` is the empty composition, then the complement is the empty composition as well. Otherwise, let `S` be the descent set of `I` (that is, the subset `\{ i_1, i_1 + i_2, \ldots, i_1 + i_2 + \cdots + i_{k-1...
src/sage/combinat/composition.py
complement
LaisRast/sage
1,742
python
@combinatorial_map(order=2, name='complement') def complement(self) -> Composition: '\n Return the complement of the composition ``self``.\n\n The complement of a composition `I` is defined as follows:\n\n If `I` is the empty composition, then the complement is the empty\n composition as...
@combinatorial_map(order=2, name='complement') def complement(self) -> Composition: '\n Return the complement of the composition ``self``.\n\n The complement of a composition `I` is defined as follows:\n\n If `I` is the empty composition, then the complement is the empty\n composition as...
2913b748ba5739bac930fa7c353a82a3ac45a36663787e080b34058f5915e454
def __add__(self, other) -> Composition: '\n Return the concatenation of two compositions.\n\n EXAMPLES::\n\n sage: Composition([1, 1, 3]) + Composition([4, 1, 2])\n [1, 1, 3, 4, 1, 2]\n\n TESTS::\n\n sage: Composition([]) + Composition([]) == Composition([])\n ...
Return the concatenation of two compositions. EXAMPLES:: sage: Composition([1, 1, 3]) + Composition([4, 1, 2]) [1, 1, 3, 4, 1, 2] TESTS:: sage: Composition([]) + Composition([]) == Composition([]) True
src/sage/combinat/composition.py
__add__
LaisRast/sage
1,742
python
def __add__(self, other) -> Composition: '\n Return the concatenation of two compositions.\n\n EXAMPLES::\n\n sage: Composition([1, 1, 3]) + Composition([4, 1, 2])\n [1, 1, 3, 4, 1, 2]\n\n TESTS::\n\n sage: Composition([]) + Composition([]) == Composition([])\n ...
def __add__(self, other) -> Composition: '\n Return the concatenation of two compositions.\n\n EXAMPLES::\n\n sage: Composition([1, 1, 3]) + Composition([4, 1, 2])\n [1, 1, 3, 4, 1, 2]\n\n TESTS::\n\n sage: Composition([]) + Composition([]) == Composition([])\n ...
76b5baacf076bd99b0fb222c2316b93f4be168d4b1d023e33599a1e3eff96954
def size(self) -> int: '\n Return the size of ``self``, that is the sum of its parts.\n\n EXAMPLES::\n\n sage: Composition([7,1,3]).size()\n 11\n ' return sum(self)
Return the size of ``self``, that is the sum of its parts. EXAMPLES:: sage: Composition([7,1,3]).size() 11
src/sage/combinat/composition.py
size
LaisRast/sage
1,742
python
def size(self) -> int: '\n Return the size of ``self``, that is the sum of its parts.\n\n EXAMPLES::\n\n sage: Composition([7,1,3]).size()\n 11\n ' return sum(self)
def size(self) -> int: '\n Return the size of ``self``, that is the sum of its parts.\n\n EXAMPLES::\n\n sage: Composition([7,1,3]).size()\n 11\n ' return sum(self)<|docstring|>Return the size of ``self``, that is the sum of its parts. EXAMPLES:: sage: Compositio...
9fe254c50c8145a1275831e7c133823b3d063b8a2b089bd42f749fad730a56b9
@staticmethod def sum(compositions) -> Composition: '\n Return the concatenation of the given compositions.\n\n INPUT:\n\n - ``compositions`` -- a list (or iterable) of compositions\n\n EXAMPLES::\n\n sage: Composition.sum([Composition([1, 1, 3]), Composition([4, 1, 2]), Compo...
Return the concatenation of the given compositions. INPUT: - ``compositions`` -- a list (or iterable) of compositions EXAMPLES:: sage: Composition.sum([Composition([1, 1, 3]), Composition([4, 1, 2]), Composition([3,1])]) [1, 1, 3, 4, 1, 2, 3, 1] Any iterable can be provided as input:: sage: Compositio...
src/sage/combinat/composition.py
sum
LaisRast/sage
1,742
python
@staticmethod def sum(compositions) -> Composition: '\n Return the concatenation of the given compositions.\n\n INPUT:\n\n - ``compositions`` -- a list (or iterable) of compositions\n\n EXAMPLES::\n\n sage: Composition.sum([Composition([1, 1, 3]), Composition([4, 1, 2]), Compo...
@staticmethod def sum(compositions) -> Composition: '\n Return the concatenation of the given compositions.\n\n INPUT:\n\n - ``compositions`` -- a list (or iterable) of compositions\n\n EXAMPLES::\n\n sage: Composition.sum([Composition([1, 1, 3]), Composition([4, 1, 2]), Compo...
09bf0cb0a523320a8bf93517de698c973f8a7caa92f9fab7624f213be9c94dc1
def near_concatenation(self, other): '\n Return the near-concatenation of two nonempty compositions\n ``self`` and ``other``.\n\n The near-concatenation `I \\odot J` of two nonempty compositions\n `I` and `J` is defined as the composition\n `(i_1, i_2, \\ldots , i_{n-1}, i_n + j_1...
Return the near-concatenation of two nonempty compositions ``self`` and ``other``. The near-concatenation `I \odot J` of two nonempty compositions `I` and `J` is defined as the composition `(i_1, i_2, \ldots , i_{n-1}, i_n + j_1, j_2, j_3, \ldots , j_m)`, where `(i_1, i_2, \ldots , i_n) = I` and `(j_1, j_2, \ldots , j...
src/sage/combinat/composition.py
near_concatenation
LaisRast/sage
1,742
python
def near_concatenation(self, other): '\n Return the near-concatenation of two nonempty compositions\n ``self`` and ``other``.\n\n The near-concatenation `I \\odot J` of two nonempty compositions\n `I` and `J` is defined as the composition\n `(i_1, i_2, \\ldots , i_{n-1}, i_n + j_1...
def near_concatenation(self, other): '\n Return the near-concatenation of two nonempty compositions\n ``self`` and ``other``.\n\n The near-concatenation `I \\odot J` of two nonempty compositions\n `I` and `J` is defined as the composition\n `(i_1, i_2, \\ldots , i_{n-1}, i_n + j_1...
4260f8e6c39a7f2a885b9f9795132de2f7779dbd74958b9a50317e3d86903954
def ribbon_decomposition(self, other, check=True): '\n Return a pair describing the ribbon decomposition of a composition\n ``self`` with respect to a composition ``other`` of the same size.\n\n If `I` and `J` are two compositions of the same nonzero size, then\n the ribbon decomposition...
Return a pair describing the ribbon decomposition of a composition ``self`` with respect to a composition ``other`` of the same size. If `I` and `J` are two compositions of the same nonzero size, then the ribbon decomposition of `I` with respect to `J` is defined as follows: Write `I` and `J` as `I = (i_1, i_2, \ldots...
src/sage/combinat/composition.py
ribbon_decomposition
LaisRast/sage
1,742
python
def ribbon_decomposition(self, other, check=True): '\n Return a pair describing the ribbon decomposition of a composition\n ``self`` with respect to a composition ``other`` of the same size.\n\n If `I` and `J` are two compositions of the same nonzero size, then\n the ribbon decomposition...
def ribbon_decomposition(self, other, check=True): '\n Return a pair describing the ribbon decomposition of a composition\n ``self`` with respect to a composition ``other`` of the same size.\n\n If `I` and `J` are two compositions of the same nonzero size, then\n the ribbon decomposition...
cff2249dc6f69381d655186355ceef66d23318f0504c7fc319909b4b4f03d131
def join(self, other, check=True) -> Composition: '\n Return the join of ``self`` with a composition ``other`` of the\n same size.\n\n The join of two compositions `I` and `J` of size `n` is the\n coarsest composition of `n` which refines each of `I` and `J`. It\n can be described...
Return the join of ``self`` with a composition ``other`` of the same size. The join of two compositions `I` and `J` of size `n` is the coarsest composition of `n` which refines each of `I` and `J`. It can be described as the composition whose descent set is the union of the descent sets of `I` and `J`. It is also the ...
src/sage/combinat/composition.py
join
LaisRast/sage
1,742
python
def join(self, other, check=True) -> Composition: '\n Return the join of ``self`` with a composition ``other`` of the\n same size.\n\n The join of two compositions `I` and `J` of size `n` is the\n coarsest composition of `n` which refines each of `I` and `J`. It\n can be described...
def join(self, other, check=True) -> Composition: '\n Return the join of ``self`` with a composition ``other`` of the\n same size.\n\n The join of two compositions `I` and `J` of size `n` is the\n coarsest composition of `n` which refines each of `I` and `J`. It\n can be described...
3d6fc6bf4419150f7719f166abf0bb986d9a6ea94fac39bbca9c2d83506b417f
def meet(self, other, check=True) -> Composition: '\n Return the meet of ``self`` with a composition ``other`` of the\n same size.\n\n The meet of two compositions `I` and `J` of size `n` is the\n finest composition of `n` which is coarser than each of `I` and\n `J`. It can be des...
Return the meet of ``self`` with a composition ``other`` of the same size. The meet of two compositions `I` and `J` of size `n` is the finest composition of `n` which is coarser than each of `I` and `J`. It can be described as the composition whose descent set is the intersection of the descent sets of `I` and `J`. I...
src/sage/combinat/composition.py
meet
LaisRast/sage
1,742
python
def meet(self, other, check=True) -> Composition: '\n Return the meet of ``self`` with a composition ``other`` of the\n same size.\n\n The meet of two compositions `I` and `J` of size `n` is the\n finest composition of `n` which is coarser than each of `I` and\n `J`. It can be des...
def meet(self, other, check=True) -> Composition: '\n Return the meet of ``self`` with a composition ``other`` of the\n same size.\n\n The meet of two compositions `I` and `J` of size `n` is the\n finest composition of `n` which is coarser than each of `I` and\n `J`. It can be des...
616603205080ec1551368cfddbb1ddad353e10b77109918e9808f195c3833514
def finer(self): '\n Return the set of compositions which are finer than ``self``.\n\n EXAMPLES::\n\n sage: C = Composition([3,2]).finer()\n sage: C.cardinality()\n 8\n sage: C.list()\n [[1, 1, 1, 1, 1], [1, 1, 1, 2], [1, 2, 1, 1], [1, 2, 2], [2, ...
Return the set of compositions which are finer than ``self``. EXAMPLES:: sage: C = Composition([3,2]).finer() sage: C.cardinality() 8 sage: C.list() [[1, 1, 1, 1, 1], [1, 1, 1, 2], [1, 2, 1, 1], [1, 2, 2], [2, 1, 1, 1], [2, 1, 2], [3, 1, 1], [3, 2]] sage: Composition([]).finer() {[]}
src/sage/combinat/composition.py
finer
LaisRast/sage
1,742
python
def finer(self): '\n Return the set of compositions which are finer than ``self``.\n\n EXAMPLES::\n\n sage: C = Composition([3,2]).finer()\n sage: C.cardinality()\n 8\n sage: C.list()\n [[1, 1, 1, 1, 1], [1, 1, 1, 2], [1, 2, 1, 1], [1, 2, 2], [2, ...
def finer(self): '\n Return the set of compositions which are finer than ``self``.\n\n EXAMPLES::\n\n sage: C = Composition([3,2]).finer()\n sage: C.cardinality()\n 8\n sage: C.list()\n [[1, 1, 1, 1, 1], [1, 1, 1, 2], [1, 2, 1, 1], [1, 2, 2], [2, ...
987a87aa61a771b224ad14ad4fa970319d5e4e9124708cefc8ef906c58938b0b
def is_finer(self, co2) -> bool: '\n Return ``True`` if the composition ``self`` is finer than the\n composition ``co2``; otherwise, return ``False``.\n\n EXAMPLES::\n\n sage: Composition([4,1,2]).is_finer([3,1,3])\n False\n sage: Composition([3,1,3]).is_finer([...
Return ``True`` if the composition ``self`` is finer than the composition ``co2``; otherwise, return ``False``. EXAMPLES:: sage: Composition([4,1,2]).is_finer([3,1,3]) False sage: Composition([3,1,3]).is_finer([4,1,2]) False sage: Composition([1,2,2,1,1,2]).is_finer([5,1,3]) True sage: Com...
src/sage/combinat/composition.py
is_finer
LaisRast/sage
1,742
python
def is_finer(self, co2) -> bool: '\n Return ``True`` if the composition ``self`` is finer than the\n composition ``co2``; otherwise, return ``False``.\n\n EXAMPLES::\n\n sage: Composition([4,1,2]).is_finer([3,1,3])\n False\n sage: Composition([3,1,3]).is_finer([...
def is_finer(self, co2) -> bool: '\n Return ``True`` if the composition ``self`` is finer than the\n composition ``co2``; otherwise, return ``False``.\n\n EXAMPLES::\n\n sage: Composition([4,1,2]).is_finer([3,1,3])\n False\n sage: Composition([3,1,3]).is_finer([...
1cfd6d886af210138e2f31df1777f57a418e249adad24d7dd7971be9bfe8b9a2
def fatten(self, grouping) -> Composition: '\n Return the composition fatter than ``self``, obtained by grouping\n together consecutive parts according to ``grouping``.\n\n INPUT:\n\n - ``grouping`` -- a composition whose sum is the length of ``self``\n\n EXAMPLES:\n\n Let ...
Return the composition fatter than ``self``, obtained by grouping together consecutive parts according to ``grouping``. INPUT: - ``grouping`` -- a composition whose sum is the length of ``self`` EXAMPLES: Let us start with the composition:: sage: c = Composition([4,5,2,7,1]) With ``grouping`` equal to `(1, \l...
src/sage/combinat/composition.py
fatten
LaisRast/sage
1,742
python
def fatten(self, grouping) -> Composition: '\n Return the composition fatter than ``self``, obtained by grouping\n together consecutive parts according to ``grouping``.\n\n INPUT:\n\n - ``grouping`` -- a composition whose sum is the length of ``self``\n\n EXAMPLES:\n\n Let ...
def fatten(self, grouping) -> Composition: '\n Return the composition fatter than ``self``, obtained by grouping\n together consecutive parts according to ``grouping``.\n\n INPUT:\n\n - ``grouping`` -- a composition whose sum is the length of ``self``\n\n EXAMPLES:\n\n Let ...
6db42b200621fd6ad269cc7435fca130afad5e91d85ad35b81edf22bf51ed695
def fatter(self): '\n Return the set of compositions which are fatter than ``self``.\n\n Complexity for generation: `O(|c|)` memory, `O(|r|)` time where `|c|`\n is the size of ``self`` and `r` is the result.\n\n EXAMPLES::\n\n sage: C = Composition([4,5,2]).fatter()\n ...
Return the set of compositions which are fatter than ``self``. Complexity for generation: `O(|c|)` memory, `O(|r|)` time where `|c|` is the size of ``self`` and `r` is the result. EXAMPLES:: sage: C = Composition([4,5,2]).fatter() sage: C.cardinality() 4 sage: list(C) [[4, 5, 2], [4, 7], [9, 2], ...
src/sage/combinat/composition.py
fatter
LaisRast/sage
1,742
python
def fatter(self): '\n Return the set of compositions which are fatter than ``self``.\n\n Complexity for generation: `O(|c|)` memory, `O(|r|)` time where `|c|`\n is the size of ``self`` and `r` is the result.\n\n EXAMPLES::\n\n sage: C = Composition([4,5,2]).fatter()\n ...
def fatter(self): '\n Return the set of compositions which are fatter than ``self``.\n\n Complexity for generation: `O(|c|)` memory, `O(|r|)` time where `|c|`\n is the size of ``self`` and `r` is the result.\n\n EXAMPLES::\n\n sage: C = Composition([4,5,2]).fatter()\n ...
a4b194e52d46413abdf99c9c63935d696bb0d409f25034c51f8c1ca7346f6976
def refinement_splitting(self, J) -> list[Composition]: '\n Return the refinement splitting of ``self`` according to ``J``.\n\n INPUT:\n\n - ``J`` -- A composition such that ``self`` is finer than ``J``\n\n OUTPUT:\n\n - the unique list of compositions `(I^{(p)})_{p=1, \\ldots , m...
Return the refinement splitting of ``self`` according to ``J``. INPUT: - ``J`` -- A composition such that ``self`` is finer than ``J`` OUTPUT: - the unique list of compositions `(I^{(p)})_{p=1, \ldots , m}`, obtained by splitting `I`, such that `|I^{(p)}| = J_p` for all `p = 1, \ldots, m`. .. SEEALSO:: :m...
src/sage/combinat/composition.py
refinement_splitting
LaisRast/sage
1,742
python
def refinement_splitting(self, J) -> list[Composition]: '\n Return the refinement splitting of ``self`` according to ``J``.\n\n INPUT:\n\n - ``J`` -- A composition such that ``self`` is finer than ``J``\n\n OUTPUT:\n\n - the unique list of compositions `(I^{(p)})_{p=1, \\ldots , m...
def refinement_splitting(self, J) -> list[Composition]: '\n Return the refinement splitting of ``self`` according to ``J``.\n\n INPUT:\n\n - ``J`` -- A composition such that ``self`` is finer than ``J``\n\n OUTPUT:\n\n - the unique list of compositions `(I^{(p)})_{p=1, \\ldots , m...
75cba63aab69a2d08107e5baa63b4fe1aef1650d4ab8f51037233db24ddd7f78
def refinement_splitting_lengths(self, J): '\n Return the lengths of the compositions in the refinement splitting of\n ``self`` according to ``J``.\n\n .. SEEALSO::\n\n :meth:`refinement_splitting` for the definition of refinement splitting\n\n EXAMPLES::\n\n sage: ...
Return the lengths of the compositions in the refinement splitting of ``self`` according to ``J``. .. SEEALSO:: :meth:`refinement_splitting` for the definition of refinement splitting EXAMPLES:: sage: Composition([1,2,2,1,1,2]).refinement_splitting_lengths([5,1,3]) [3, 1, 2] sage: Composition([]).re...
src/sage/combinat/composition.py
refinement_splitting_lengths
LaisRast/sage
1,742
python
def refinement_splitting_lengths(self, J): '\n Return the lengths of the compositions in the refinement splitting of\n ``self`` according to ``J``.\n\n .. SEEALSO::\n\n :meth:`refinement_splitting` for the definition of refinement splitting\n\n EXAMPLES::\n\n sage: ...
def refinement_splitting_lengths(self, J): '\n Return the lengths of the compositions in the refinement splitting of\n ``self`` according to ``J``.\n\n .. SEEALSO::\n\n :meth:`refinement_splitting` for the definition of refinement splitting\n\n EXAMPLES::\n\n sage: ...
0289f3f715ddc9b6bb8a46cfd862114e5b66c0a7df93915b3d80428dbbb79a25
def major_index(self) -> int: '\n Return the major index of ``self``. The major index is\n defined as the sum of the descents.\n\n EXAMPLES::\n\n sage: Composition([1, 1, 3, 1, 2, 1, 3]).major_index()\n 31\n ' lv = len(self) if (lv == 1): return 0 ...
Return the major index of ``self``. The major index is defined as the sum of the descents. EXAMPLES:: sage: Composition([1, 1, 3, 1, 2, 1, 3]).major_index() 31
src/sage/combinat/composition.py
major_index
LaisRast/sage
1,742
python
def major_index(self) -> int: '\n Return the major index of ``self``. The major index is\n defined as the sum of the descents.\n\n EXAMPLES::\n\n sage: Composition([1, 1, 3, 1, 2, 1, 3]).major_index()\n 31\n ' lv = len(self) if (lv == 1): return 0 ...
def major_index(self) -> int: '\n Return the major index of ``self``. The major index is\n defined as the sum of the descents.\n\n EXAMPLES::\n\n sage: Composition([1, 1, 3, 1, 2, 1, 3]).major_index()\n 31\n ' lv = len(self) if (lv == 1): return 0 ...
0fd80f9348d51637b8ae17c6dff222411cb23954109e9a51a7895f0d05698394
def to_code(self) -> list: '\n Return the code of the composition ``self``.\n\n The code of a composition `I` is a list of length\n `\\mathrm{size}(I)` of 1s and 0s such that there is a 1\n wherever a new part starts. (Exceptional case: When the\n composition is empty, the code is...
Return the code of the composition ``self``. The code of a composition `I` is a list of length `\mathrm{size}(I)` of 1s and 0s such that there is a 1 wherever a new part starts. (Exceptional case: When the composition is empty, the code is ``[0]``.) EXAMPLES:: sage: Composition([4,1,2,3,5]).to_code() [1, 0, ...
src/sage/combinat/composition.py
to_code
LaisRast/sage
1,742
python
def to_code(self) -> list: '\n Return the code of the composition ``self``.\n\n The code of a composition `I` is a list of length\n `\\mathrm{size}(I)` of 1s and 0s such that there is a 1\n wherever a new part starts. (Exceptional case: When the\n composition is empty, the code is...
def to_code(self) -> list: '\n Return the code of the composition ``self``.\n\n The code of a composition `I` is a list of length\n `\\mathrm{size}(I)` of 1s and 0s such that there is a 1\n wherever a new part starts. (Exceptional case: When the\n composition is empty, the code is...
aab0a1f5f0adb41befa2ceb8dfd332e44ce84d089789809c888c3b1051677193
def partial_sums(self, final=True) -> list: '\n The partial sums of the sequence defined by the entries of the\n composition.\n\n If `I = (i_1, \\ldots, i_m)` is a composition, then the partial sums of\n the entries of the composition are\n `[i_1, i_1 + i_2, \\ldots, i_1 + i_2 + \...
The partial sums of the sequence defined by the entries of the composition. If `I = (i_1, \ldots, i_m)` is a composition, then the partial sums of the entries of the composition are `[i_1, i_1 + i_2, \ldots, i_1 + i_2 + \cdots + i_m]`. INPUT: - ``final`` -- (default: ``True``) whether or not to include the final p...
src/sage/combinat/composition.py
partial_sums
LaisRast/sage
1,742
python
def partial_sums(self, final=True) -> list: '\n The partial sums of the sequence defined by the entries of the\n composition.\n\n If `I = (i_1, \\ldots, i_m)` is a composition, then the partial sums of\n the entries of the composition are\n `[i_1, i_1 + i_2, \\ldots, i_1 + i_2 + \...
def partial_sums(self, final=True) -> list: '\n The partial sums of the sequence defined by the entries of the\n composition.\n\n If `I = (i_1, \\ldots, i_m)` is a composition, then the partial sums of\n the entries of the composition are\n `[i_1, i_1 + i_2, \\ldots, i_1 + i_2 + \...
806d32ef4504789868f65be343c29ec22b1865a1ba37ed16a238c8523368e30d
def to_subset(self, final=False): '\n The subset corresponding to ``self`` under the bijection (see below)\n between compositions of `n` and subsets of `\\{1, 2, \\ldots, n-1\\}`.\n\n The bijection maps a composition `(i_1, \\ldots, i_k)` of `n` to\n `\\{i_1, i_1 + i_2, i_1 + i_2 + i_3, ...
The subset corresponding to ``self`` under the bijection (see below) between compositions of `n` and subsets of `\{1, 2, \ldots, n-1\}`. The bijection maps a composition `(i_1, \ldots, i_k)` of `n` to `\{i_1, i_1 + i_2, i_1 + i_2 + i_3, \ldots, i_1 + \cdots + i_{k-1}\}`. INPUT: - ``final`` -- (default: ``False``) wh...
src/sage/combinat/composition.py
to_subset
LaisRast/sage
1,742
python
def to_subset(self, final=False): '\n The subset corresponding to ``self`` under the bijection (see below)\n between compositions of `n` and subsets of `\\{1, 2, \\ldots, n-1\\}`.\n\n The bijection maps a composition `(i_1, \\ldots, i_k)` of `n` to\n `\\{i_1, i_1 + i_2, i_1 + i_2 + i_3, ...
def to_subset(self, final=False): '\n The subset corresponding to ``self`` under the bijection (see below)\n between compositions of `n` and subsets of `\\{1, 2, \\ldots, n-1\\}`.\n\n The bijection maps a composition `(i_1, \\ldots, i_k)` of `n` to\n `\\{i_1, i_1 + i_2, i_1 + i_2 + i_3, ...
ea962cd667517df61598e239d5e89319fe6733899db1657e770dae85cfcf1b57
def descents(self, final_descent=False) -> list: '\n This gives one fewer than the partial sums of the composition.\n\n This is here to maintain some sort of backward compatibility, even\n through the original implementation was broken (it gave the wrong\n answer). The same information c...
This gives one fewer than the partial sums of the composition. This is here to maintain some sort of backward compatibility, even through the original implementation was broken (it gave the wrong answer). The same information can be found in :meth:`partial_sums`. .. SEEALSO:: :meth:`partial_sums` INPUT: - ``fi...
src/sage/combinat/composition.py
descents
LaisRast/sage
1,742
python
def descents(self, final_descent=False) -> list: '\n This gives one fewer than the partial sums of the composition.\n\n This is here to maintain some sort of backward compatibility, even\n through the original implementation was broken (it gave the wrong\n answer). The same information c...
def descents(self, final_descent=False) -> list: '\n This gives one fewer than the partial sums of the composition.\n\n This is here to maintain some sort of backward compatibility, even\n through the original implementation was broken (it gave the wrong\n answer). The same information c...
f9b76ea1ea6c1ecc7d3f7464a89b2f5097d1865a65320f5db09bfde437419f18
def peaks(self) -> list: '\n Return a list of the peaks of the composition ``self``.\n\n The peaks of a composition are the descents which do not\n immediately follow another descent.\n\n EXAMPLES::\n\n sage: Composition([1, 1, 3, 1, 2, 1, 3]).peaks()\n [4, 7]\n ...
Return a list of the peaks of the composition ``self``. The peaks of a composition are the descents which do not immediately follow another descent. EXAMPLES:: sage: Composition([1, 1, 3, 1, 2, 1, 3]).peaks() [4, 7]
src/sage/combinat/composition.py
peaks
LaisRast/sage
1,742
python
def peaks(self) -> list: '\n Return a list of the peaks of the composition ``self``.\n\n The peaks of a composition are the descents which do not\n immediately follow another descent.\n\n EXAMPLES::\n\n sage: Composition([1, 1, 3, 1, 2, 1, 3]).peaks()\n [4, 7]\n ...
def peaks(self) -> list: '\n Return a list of the peaks of the composition ``self``.\n\n The peaks of a composition are the descents which do not\n immediately follow another descent.\n\n EXAMPLES::\n\n sage: Composition([1, 1, 3, 1, 2, 1, 3]).peaks()\n [4, 7]\n ...
16459ef774a220c1e957945d857c41ab5092714fa2ef505019e99584bc43e6a2
@combinatorial_map(name='to partition') def to_partition(self): '\n Return the partition obtained by sorting ``self`` into decreasing\n order.\n\n EXAMPLES::\n\n sage: Composition([2,1,3]).to_partition()\n [3, 2, 1]\n sage: Composition([4,2,2]).to_partition()\n ...
Return the partition obtained by sorting ``self`` into decreasing order. EXAMPLES:: sage: Composition([2,1,3]).to_partition() [3, 2, 1] sage: Composition([4,2,2]).to_partition() [4, 2, 2] sage: Composition([]).to_partition() []
src/sage/combinat/composition.py
to_partition
LaisRast/sage
1,742
python
@combinatorial_map(name='to partition') def to_partition(self): '\n Return the partition obtained by sorting ``self`` into decreasing\n order.\n\n EXAMPLES::\n\n sage: Composition([2,1,3]).to_partition()\n [3, 2, 1]\n sage: Composition([4,2,2]).to_partition()\n ...
@combinatorial_map(name='to partition') def to_partition(self): '\n Return the partition obtained by sorting ``self`` into decreasing\n order.\n\n EXAMPLES::\n\n sage: Composition([2,1,3]).to_partition()\n [3, 2, 1]\n sage: Composition([4,2,2]).to_partition()\n ...
74af69816849f048cf0f1cdc06e6cb458060e1fcb0e8538ba3b94ba90a4116c2
def to_skew_partition(self, overlap=1): '\n Return the skew partition obtained from ``self``.\n\n This is a skew partition whose rows have the entries of\n ``self`` as their length, taken in reverse order (so the first\n entry of ``self`` is the length of the lowermost row,\n etc....
Return the skew partition obtained from ``self``. This is a skew partition whose rows have the entries of ``self`` as their length, taken in reverse order (so the first entry of ``self`` is the length of the lowermost row, etc.). The parameter ``overlap`` indicates the number of cells on each row that are directly bel...
src/sage/combinat/composition.py
to_skew_partition
LaisRast/sage
1,742
python
def to_skew_partition(self, overlap=1): '\n Return the skew partition obtained from ``self``.\n\n This is a skew partition whose rows have the entries of\n ``self`` as their length, taken in reverse order (so the first\n entry of ``self`` is the length of the lowermost row,\n etc....
def to_skew_partition(self, overlap=1): '\n Return the skew partition obtained from ``self``.\n\n This is a skew partition whose rows have the entries of\n ``self`` as their length, taken in reverse order (so the first\n entry of ``self`` is the length of the lowermost row,\n etc....
ddc5886b7cd295e0fae24bedb26fa9d30762e30159afb58e33d9ec93e4e0c11b
def shuffle_product(self, other, overlap=False): '\n The (overlapping) shuffles of ``self`` and ``other``.\n\n Suppose `I = (i_1, \\ldots, i_k)` and `J = (j_1, \\ldots, j_l)` are two\n compositions. A *shuffle* of `I` and `J` is a composition of length\n `k + l` that contains both `I` an...
The (overlapping) shuffles of ``self`` and ``other``. Suppose `I = (i_1, \ldots, i_k)` and `J = (j_1, \ldots, j_l)` are two compositions. A *shuffle* of `I` and `J` is a composition of length `k + l` that contains both `I` and `J` as subsequences. More generally, an *overlapping shuffle* of `I` and `J` is obtained by...
src/sage/combinat/composition.py
shuffle_product
LaisRast/sage
1,742
python
def shuffle_product(self, other, overlap=False): '\n The (overlapping) shuffles of ``self`` and ``other``.\n\n Suppose `I = (i_1, \\ldots, i_k)` and `J = (j_1, \\ldots, j_l)` are two\n compositions. A *shuffle* of `I` and `J` is a composition of length\n `k + l` that contains both `I` an...
def shuffle_product(self, other, overlap=False): '\n The (overlapping) shuffles of ``self`` and ``other``.\n\n Suppose `I = (i_1, \\ldots, i_k)` and `J = (j_1, \\ldots, j_l)` are two\n compositions. A *shuffle* of `I` and `J` is a composition of length\n `k + l` that contains both `I` an...
18219f00921bba4816ef657e2fafe2264bada745f2601592baa1f29d63ccb3a2
def wll_gt(self, co2) -> bool: '\n Return ``True`` if the composition ``self`` is greater than the\n composition ``co2`` with respect to the wll-ordering; otherwise,\n return ``False``.\n\n The wll-ordering is a total order on the set of all compositions\n defined as follows: A co...
Return ``True`` if the composition ``self`` is greater than the composition ``co2`` with respect to the wll-ordering; otherwise, return ``False``. The wll-ordering is a total order on the set of all compositions defined as follows: A composition `I` is greater than a composition `J` if and only if one of the following...
src/sage/combinat/composition.py
wll_gt
LaisRast/sage
1,742
python
def wll_gt(self, co2) -> bool: '\n Return ``True`` if the composition ``self`` is greater than the\n composition ``co2`` with respect to the wll-ordering; otherwise,\n return ``False``.\n\n The wll-ordering is a total order on the set of all compositions\n defined as follows: A co...
def wll_gt(self, co2) -> bool: '\n Return ``True`` if the composition ``self`` is greater than the\n composition ``co2`` with respect to the wll-ordering; otherwise,\n return ``False``.\n\n The wll-ordering is a total order on the set of all compositions\n defined as follows: A co...
358922a272f40468d20ac98d38de94db43fa1304b35d218ba7830d5e03d2cc86
@staticmethod def __classcall_private__(self, n=None, **kwargs): '\n Return the correct parent based upon the input.\n\n EXAMPLES::\n\n sage: C = Compositions(3)\n sage: C2 = Compositions(int(3))\n sage: C is C2\n True\n ' if (n is None): ...
Return the correct parent based upon the input. EXAMPLES:: sage: C = Compositions(3) sage: C2 = Compositions(int(3)) sage: C is C2 True
src/sage/combinat/composition.py
__classcall_private__
LaisRast/sage
1,742
python
@staticmethod def __classcall_private__(self, n=None, **kwargs): '\n Return the correct parent based upon the input.\n\n EXAMPLES::\n\n sage: C = Compositions(3)\n sage: C2 = Compositions(int(3))\n sage: C is C2\n True\n ' if (n is None): ...
@staticmethod def __classcall_private__(self, n=None, **kwargs): '\n Return the correct parent based upon the input.\n\n EXAMPLES::\n\n sage: C = Compositions(3)\n sage: C2 = Compositions(int(3))\n sage: C is C2\n True\n ' if (n is None): ...
cb88cb3f85e6c3bd4d8fc8a85f2f94b95b01c446cc2b20ac246d00730f8b8a63
def __init__(self, is_infinite=False): '\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: C = Compositions()\n sage: TestSuite(C).run()\n ' if is_infinite: Parent.__init__(self, category=InfiniteEnumeratedSets()) else: Parent.__init__(self, category=...
Initialize ``self``. EXAMPLES:: sage: C = Compositions() sage: TestSuite(C).run()
src/sage/combinat/composition.py
__init__
LaisRast/sage
1,742
python
def __init__(self, is_infinite=False): '\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: C = Compositions()\n sage: TestSuite(C).run()\n ' if is_infinite: Parent.__init__(self, category=InfiniteEnumeratedSets()) else: Parent.__init__(self, category=...
def __init__(self, is_infinite=False): '\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: C = Compositions()\n sage: TestSuite(C).run()\n ' if is_infinite: Parent.__init__(self, category=InfiniteEnumeratedSets()) else: Parent.__init__(self, category=...
ffb63191c67bef06f5752a1895816dd981a733d39b35be23b703f1234f853647
def _element_constructor_(self, lst) -> Composition: '\n Construct an element with ``self`` as parent.\n\n EXAMPLES::\n\n sage: P = Compositions()\n sage: P([3,3,1]) # indirect doctest\n [3, 3, 1]\n ' if isinstance(lst, Composition): lst = list(lst) ...
Construct an element with ``self`` as parent. EXAMPLES:: sage: P = Compositions() sage: P([3,3,1]) # indirect doctest [3, 3, 1]
src/sage/combinat/composition.py
_element_constructor_
LaisRast/sage
1,742
python
def _element_constructor_(self, lst) -> Composition: '\n Construct an element with ``self`` as parent.\n\n EXAMPLES::\n\n sage: P = Compositions()\n sage: P([3,3,1]) # indirect doctest\n [3, 3, 1]\n ' if isinstance(lst, Composition): lst = list(lst) ...
def _element_constructor_(self, lst) -> Composition: '\n Construct an element with ``self`` as parent.\n\n EXAMPLES::\n\n sage: P = Compositions()\n sage: P([3,3,1]) # indirect doctest\n [3, 3, 1]\n ' if isinstance(lst, Composition): lst = list(lst) ...
a11155f8ad2c6177beeff723cba792cff13019ecf7f7dd50719aa5e0c1cdb22b
def __contains__(self, x) -> bool: '\n TESTS::\n\n sage: [2,1,3] in Compositions()\n True\n sage: [] in Compositions()\n True\n sage: [-2,-1] in Compositions()\n False\n sage: [0,0] in Compositions()\n True\n ' ...
TESTS:: sage: [2,1,3] in Compositions() True sage: [] in Compositions() True sage: [-2,-1] in Compositions() False sage: [0,0] in Compositions() True
src/sage/combinat/composition.py
__contains__
LaisRast/sage
1,742
python
def __contains__(self, x) -> bool: '\n TESTS::\n\n sage: [2,1,3] in Compositions()\n True\n sage: [] in Compositions()\n True\n sage: [-2,-1] in Compositions()\n False\n sage: [0,0] in Compositions()\n True\n ' ...
def __contains__(self, x) -> bool: '\n TESTS::\n\n sage: [2,1,3] in Compositions()\n True\n sage: [] in Compositions()\n True\n sage: [-2,-1] in Compositions()\n False\n sage: [0,0] in Compositions()\n True\n ' ...
a9676344390824767d9bda57bb00246883d2d94a9e0500dcce41c5d388e33dbb
def from_descents(self, descents, nps=None) -> Composition: '\n Return a composition from the list of descents.\n\n INPUT:\n\n - ``descents`` -- an iterable\n\n - ``nps`` -- (default: ``None``) an integer or ``None``\n\n OUTPUT:\n\n - The composition of ``nps`` whose descen...
Return a composition from the list of descents. INPUT: - ``descents`` -- an iterable - ``nps`` -- (default: ``None``) an integer or ``None`` OUTPUT: - The composition of ``nps`` whose descents are listed in ``descents``, assuming that ``nps`` is not ``None`` (otherwise, the last element of ``descents`` is remo...
src/sage/combinat/composition.py
from_descents
LaisRast/sage
1,742
python
def from_descents(self, descents, nps=None) -> Composition: '\n Return a composition from the list of descents.\n\n INPUT:\n\n - ``descents`` -- an iterable\n\n - ``nps`` -- (default: ``None``) an integer or ``None``\n\n OUTPUT:\n\n - The composition of ``nps`` whose descen...
def from_descents(self, descents, nps=None) -> Composition: '\n Return a composition from the list of descents.\n\n INPUT:\n\n - ``descents`` -- an iterable\n\n - ``nps`` -- (default: ``None``) an integer or ``None``\n\n OUTPUT:\n\n - The composition of ``nps`` whose descen...
3e3b6d04705665ecaa047f6fe82225749509a48a01aaf622d71189dfb22e4a4e
def from_subset(self, S, n) -> Composition: '\n The composition of `n` corresponding to the subset ``S`` of\n `\\{1, 2, \\ldots, n-1\\}` under the bijection that maps the composition\n `(i_1, i_2, \\ldots, i_k)` of `n` to the subset\n `\\{i_1, i_1 + i_2, i_1 + i_2 + i_3, \\ldots, i_1 + \...
The composition of `n` corresponding to the subset ``S`` of `\{1, 2, \ldots, n-1\}` under the bijection that maps the composition `(i_1, i_2, \ldots, i_k)` of `n` to the subset `\{i_1, i_1 + i_2, i_1 + i_2 + i_3, \ldots, i_1 + \cdots + i_{k-1}\}` (see :meth:`Composition.to_subset`). INPUT: - ``S`` -- an iterable, a s...
src/sage/combinat/composition.py
from_subset
LaisRast/sage
1,742
python
def from_subset(self, S, n) -> Composition: '\n The composition of `n` corresponding to the subset ``S`` of\n `\\{1, 2, \\ldots, n-1\\}` under the bijection that maps the composition\n `(i_1, i_2, \\ldots, i_k)` of `n` to the subset\n `\\{i_1, i_1 + i_2, i_1 + i_2 + i_3, \\ldots, i_1 + \...
def from_subset(self, S, n) -> Composition: '\n The composition of `n` corresponding to the subset ``S`` of\n `\\{1, 2, \\ldots, n-1\\}` under the bijection that maps the composition\n `(i_1, i_2, \\ldots, i_k)` of `n` to the subset\n `\\{i_1, i_1 + i_2, i_1 + i_2 + i_3, \\ldots, i_1 + \...
5cb5dc5462fd0b7bc867ab3cdfbed52910c7bc2cf9ecff87dd587ce259b01e94
def from_code(self, code) -> Composition: '\n Return the composition from its code. The code of a composition\n `I` is a list of length `\\mathrm{size}(I)` consisting of 1s and\n 0s such that there is a 1 wherever a new part starts.\n (Exceptional case: When the composition is empty, the...
Return the composition from its code. The code of a composition `I` is a list of length `\mathrm{size}(I)` consisting of 1s and 0s such that there is a 1 wherever a new part starts. (Exceptional case: When the composition is empty, the code is ``[0]``.) EXAMPLES:: sage: Composition([4,1,2,3,5]).to_code() [1, ...
src/sage/combinat/composition.py
from_code
LaisRast/sage
1,742
python
def from_code(self, code) -> Composition: '\n Return the composition from its code. The code of a composition\n `I` is a list of length `\\mathrm{size}(I)` consisting of 1s and\n 0s such that there is a 1 wherever a new part starts.\n (Exceptional case: When the composition is empty, the...
def from_code(self, code) -> Composition: '\n Return the composition from its code. The code of a composition\n `I` is a list of length `\\mathrm{size}(I)` consisting of 1s and\n 0s such that there is a 1 wherever a new part starts.\n (Exceptional case: When the composition is empty, the...
2987bf49abb9c4afd39408fcb9faec8edd9a8013399cf9a16a22bd3e88a4313c
def __setstate__(self, data): "\n TESTS::\n\n # This is the unpickling sequence for Compositions(4, max_part=2) in sage <= 4.1.1\n sage: pg_Compositions_constraints = unpickle_global('sage.combinat.composition', 'Compositions_constraints')\n sage: si = unpickle_newobj(pg_Comp...
TESTS:: # This is the unpickling sequence for Compositions(4, max_part=2) in sage <= 4.1.1 sage: pg_Compositions_constraints = unpickle_global('sage.combinat.composition', 'Compositions_constraints') sage: si = unpickle_newobj(pg_Compositions_constraints, ()) sage: pg_make_integer = unpickle_global('sa...
src/sage/combinat/composition.py
__setstate__
LaisRast/sage
1,742
python
def __setstate__(self, data): "\n TESTS::\n\n # This is the unpickling sequence for Compositions(4, max_part=2) in sage <= 4.1.1\n sage: pg_Compositions_constraints = unpickle_global('sage.combinat.composition', 'Compositions_constraints')\n sage: si = unpickle_newobj(pg_Comp...
def __setstate__(self, data): "\n TESTS::\n\n # This is the unpickling sequence for Compositions(4, max_part=2) in sage <= 4.1.1\n sage: pg_Compositions_constraints = unpickle_global('sage.combinat.composition', 'Compositions_constraints')\n sage: si = unpickle_newobj(pg_Comp...
54ee8eafd675bc9c96e05a9ab3590ce3a0631f79ae55ed414ddf034080a6a068
def __init__(self): '\n Initialize ``self``.\n\n TESTS::\n\n sage: C = Compositions()\n sage: TestSuite(C).run()\n ' Compositions.__init__(self, True)
Initialize ``self``. TESTS:: sage: C = Compositions() sage: TestSuite(C).run()
src/sage/combinat/composition.py
__init__
LaisRast/sage
1,742
python
def __init__(self): '\n Initialize ``self``.\n\n TESTS::\n\n sage: C = Compositions()\n sage: TestSuite(C).run()\n ' Compositions.__init__(self, True)
def __init__(self): '\n Initialize ``self``.\n\n TESTS::\n\n sage: C = Compositions()\n sage: TestSuite(C).run()\n ' Compositions.__init__(self, True)<|docstring|>Initialize ``self``. TESTS:: sage: C = Compositions() sage: TestSuite(C).run()<|endoftext|>
b37630fb79e404c148c3de7c61303cb1b798895e3ebb0089d47325a90a7c74a9
def _repr_(self) -> str: "\n Return a string representation of ``self``.\n\n TESTS::\n\n sage: repr(Compositions())\n 'Compositions of non-negative integers'\n " return 'Compositions of non-negative integers'
Return a string representation of ``self``. TESTS:: sage: repr(Compositions()) 'Compositions of non-negative integers'
src/sage/combinat/composition.py
_repr_
LaisRast/sage
1,742
python
def _repr_(self) -> str: "\n Return a string representation of ``self``.\n\n TESTS::\n\n sage: repr(Compositions())\n 'Compositions of non-negative integers'\n " return 'Compositions of non-negative integers'
def _repr_(self) -> str: "\n Return a string representation of ``self``.\n\n TESTS::\n\n sage: repr(Compositions())\n 'Compositions of non-negative integers'\n " return 'Compositions of non-negative integers'<|docstring|>Return a string representation of ``self``. TES...
c8e91563e33be33ce3de3715b303e821d313a39460493c1a25a602e317ee048a
def subset(self, size=None): '\n Return the set of compositions of the given size.\n\n EXAMPLES::\n\n sage: C = Compositions()\n sage: C.subset(4)\n Compositions of 4\n sage: C.subset(size=3)\n Compositions of 3\n ' if (size is None): ...
Return the set of compositions of the given size. EXAMPLES:: sage: C = Compositions() sage: C.subset(4) Compositions of 4 sage: C.subset(size=3) Compositions of 3
src/sage/combinat/composition.py
subset
LaisRast/sage
1,742
python
def subset(self, size=None): '\n Return the set of compositions of the given size.\n\n EXAMPLES::\n\n sage: C = Compositions()\n sage: C.subset(4)\n Compositions of 4\n sage: C.subset(size=3)\n Compositions of 3\n ' if (size is None): ...
def subset(self, size=None): '\n Return the set of compositions of the given size.\n\n EXAMPLES::\n\n sage: C = Compositions()\n sage: C.subset(4)\n Compositions of 4\n sage: C.subset(size=3)\n Compositions of 3\n ' if (size is None): ...
af4e44db406c212801bf4f641a5e49c866fd294a423de31b8ed0b2295b4f9db4
def __iter__(self): '\n Iterate over all compositions.\n\n TESTS::\n\n sage: C = Compositions()\n sage: it = C.__iter__()\n sage: [next(it) for i in range(10)]\n [[], [1], [1, 1], [2], [1, 1, 1], [1, 2], [2, 1], [3], [1, 1, 1, 1], [1, 1, 2]]\n ' n...
Iterate over all compositions. TESTS:: sage: C = Compositions() sage: it = C.__iter__() sage: [next(it) for i in range(10)] [[], [1], [1, 1], [2], [1, 1, 1], [1, 2], [2, 1], [3], [1, 1, 1, 1], [1, 1, 2]]
src/sage/combinat/composition.py
__iter__
LaisRast/sage
1,742
python
def __iter__(self): '\n Iterate over all compositions.\n\n TESTS::\n\n sage: C = Compositions()\n sage: it = C.__iter__()\n sage: [next(it) for i in range(10)]\n [[], [1], [1, 1], [2], [1, 1, 1], [1, 2], [2, 1], [3], [1, 1, 1, 1], [1, 1, 2]]\n ' n...
def __iter__(self): '\n Iterate over all compositions.\n\n TESTS::\n\n sage: C = Compositions()\n sage: it = C.__iter__()\n sage: [next(it) for i in range(10)]\n [[], [1], [1, 1], [2], [1, 1, 1], [1, 2], [2, 1], [3], [1, 1, 1, 1], [1, 1, 2]]\n ' n...
980c61137b53364385ab01d313930f11ce06f2eb5020f10f51bf0f0539e89658
@staticmethod def __classcall_private__(cls, n): '\n Standardize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: C = Compositions(5)\n sage: C2 = Compositions(int(5))\n sage: C3 = Compositions(ZZ(5))\n sage: C is C2\n True\n ...
Standardize input to ensure a unique representation. EXAMPLES:: sage: C = Compositions(5) sage: C2 = Compositions(int(5)) sage: C3 = Compositions(ZZ(5)) sage: C is C2 True sage: C is C3 True
src/sage/combinat/composition.py
__classcall_private__
LaisRast/sage
1,742
python
@staticmethod def __classcall_private__(cls, n): '\n Standardize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: C = Compositions(5)\n sage: C2 = Compositions(int(5))\n sage: C3 = Compositions(ZZ(5))\n sage: C is C2\n True\n ...
@staticmethod def __classcall_private__(cls, n): '\n Standardize input to ensure a unique representation.\n\n EXAMPLES::\n\n sage: C = Compositions(5)\n sage: C2 = Compositions(int(5))\n sage: C3 = Compositions(ZZ(5))\n sage: C is C2\n True\n ...
25fa8005d531dfa16eda8065674c4d125be3b9621997d8330344fefb48350d9e
def __init__(self, n): '\n TESTS::\n\n sage: C = Compositions(3)\n sage: C == loads(dumps(C))\n True\n sage: TestSuite(C).run()\n ' self.n = n Compositions.__init__(self, False)
TESTS:: sage: C = Compositions(3) sage: C == loads(dumps(C)) True sage: TestSuite(C).run()
src/sage/combinat/composition.py
__init__
LaisRast/sage
1,742
python
def __init__(self, n): '\n TESTS::\n\n sage: C = Compositions(3)\n sage: C == loads(dumps(C))\n True\n sage: TestSuite(C).run()\n ' self.n = n Compositions.__init__(self, False)
def __init__(self, n): '\n TESTS::\n\n sage: C = Compositions(3)\n sage: C == loads(dumps(C))\n True\n sage: TestSuite(C).run()\n ' self.n = n Compositions.__init__(self, False)<|docstring|>TESTS:: sage: C = Compositions(3) sage: C == loads(...
b28101881c7e4a4a81283e44d564900d91b8655fe1750cc730918931ef17c876
def _repr_(self) -> str: "\n Return a string representation of ``self``.\n\n TESTS::\n\n sage: repr(Compositions(3))\n 'Compositions of 3'\n " return ('Compositions of %s' % self.n)
Return a string representation of ``self``. TESTS:: sage: repr(Compositions(3)) 'Compositions of 3'
src/sage/combinat/composition.py
_repr_
LaisRast/sage
1,742
python
def _repr_(self) -> str: "\n Return a string representation of ``self``.\n\n TESTS::\n\n sage: repr(Compositions(3))\n 'Compositions of 3'\n " return ('Compositions of %s' % self.n)
def _repr_(self) -> str: "\n Return a string representation of ``self``.\n\n TESTS::\n\n sage: repr(Compositions(3))\n 'Compositions of 3'\n " return ('Compositions of %s' % self.n)<|docstring|>Return a string representation of ``self``. TESTS:: sage: repr(Compos...
7289e28ed2d81acc5551b23073cc743422f33b84813731366e0686f46807e221
def __contains__(self, x) -> bool: '\n TESTS::\n\n sage: [2,1,3] in Compositions(6)\n True\n sage: [2,1,2] in Compositions(6)\n False\n sage: [] in Compositions(0)\n True\n sage: [0] in Compositions(0)\n True\n ' ...
TESTS:: sage: [2,1,3] in Compositions(6) True sage: [2,1,2] in Compositions(6) False sage: [] in Compositions(0) True sage: [0] in Compositions(0) True
src/sage/combinat/composition.py
__contains__
LaisRast/sage
1,742
python
def __contains__(self, x) -> bool: '\n TESTS::\n\n sage: [2,1,3] in Compositions(6)\n True\n sage: [2,1,2] in Compositions(6)\n False\n sage: [] in Compositions(0)\n True\n sage: [0] in Compositions(0)\n True\n ' ...
def __contains__(self, x) -> bool: '\n TESTS::\n\n sage: [2,1,3] in Compositions(6)\n True\n sage: [2,1,2] in Compositions(6)\n False\n sage: [] in Compositions(0)\n True\n sage: [0] in Compositions(0)\n True\n ' ...
8e34c4a9f8728f7f53d6cc927cfe12d2c52dccd0de4df1c1151c390136ceb35f
def cardinality(self) -> Integer: '\n Return the number of compositions of `n`.\n\n TESTS::\n\n sage: Compositions(3).cardinality()\n 4\n sage: Compositions(0).cardinality()\n 1\n ' if (self.n >= 1): return (ZZ(2) ** (self.n - 1)) elif...
Return the number of compositions of `n`. TESTS:: sage: Compositions(3).cardinality() 4 sage: Compositions(0).cardinality() 1
src/sage/combinat/composition.py
cardinality
LaisRast/sage
1,742
python
def cardinality(self) -> Integer: '\n Return the number of compositions of `n`.\n\n TESTS::\n\n sage: Compositions(3).cardinality()\n 4\n sage: Compositions(0).cardinality()\n 1\n ' if (self.n >= 1): return (ZZ(2) ** (self.n - 1)) elif...
def cardinality(self) -> Integer: '\n Return the number of compositions of `n`.\n\n TESTS::\n\n sage: Compositions(3).cardinality()\n 4\n sage: Compositions(0).cardinality()\n 1\n ' if (self.n >= 1): return (ZZ(2) ** (self.n - 1)) elif...
87d9422f980bc0abedd32ed8efc9d888748da3544e0623b79efe569d27ccd7f8
def random_element(self) -> Composition: '\n Return a random ``Composition`` with uniform probability.\n\n This method generates a random binary word starting with a 1\n and then uses the bijection between compositions and their code.\n\n EXAMPLES::\n\n sage: Compositions(5).r...
Return a random ``Composition`` with uniform probability. This method generates a random binary word starting with a 1 and then uses the bijection between compositions and their code. EXAMPLES:: sage: Compositions(5).random_element() # random [2, 1, 1, 1] sage: Compositions(0).random_element() [] ...
src/sage/combinat/composition.py
random_element
LaisRast/sage
1,742
python
def random_element(self) -> Composition: '\n Return a random ``Composition`` with uniform probability.\n\n This method generates a random binary word starting with a 1\n and then uses the bijection between compositions and their code.\n\n EXAMPLES::\n\n sage: Compositions(5).r...
def random_element(self) -> Composition: '\n Return a random ``Composition`` with uniform probability.\n\n This method generates a random binary word starting with a 1\n and then uses the bijection between compositions and their code.\n\n EXAMPLES::\n\n sage: Compositions(5).r...
d83f0459773b8a466b9cd598ac33f43cbe9568c4887811b1940e80d4c3e49d12
def __iter__(self): '\n Iterate over the compositions of `n`.\n\n TESTS::\n\n sage: Compositions(4).list()\n [[1, 1, 1, 1], [1, 1, 2], [1, 2, 1], [1, 3], [2, 1, 1], [2, 2], [3, 1], [4]]\n sage: Compositions(0).list()\n [[]]\n ' for c in compositio...
Iterate over the compositions of `n`. TESTS:: sage: Compositions(4).list() [[1, 1, 1, 1], [1, 1, 2], [1, 2, 1], [1, 3], [2, 1, 1], [2, 2], [3, 1], [4]] sage: Compositions(0).list() [[]]
src/sage/combinat/composition.py
__iter__
LaisRast/sage
1,742
python
def __iter__(self): '\n Iterate over the compositions of `n`.\n\n TESTS::\n\n sage: Compositions(4).list()\n [[1, 1, 1, 1], [1, 1, 2], [1, 2, 1], [1, 3], [2, 1, 1], [2, 2], [3, 1], [4]]\n sage: Compositions(0).list()\n [[]]\n ' for c in compositio...
def __iter__(self): '\n Iterate over the compositions of `n`.\n\n TESTS::\n\n sage: Compositions(4).list()\n [[1, 1, 1, 1], [1, 1, 2], [1, 2, 1], [1, 3], [2, 1, 1], [2, 2], [3, 1], [4]]\n sage: Compositions(0).list()\n [[]]\n ' for c in compositio...
9c5fd0a0fe9a14a420df25932616cabbad9e4356bb25c420cf8a21dede292401
def imresize(D, dims, kind='cubic', use_scipy=False): "\n Resize a floating point image\n Parameters\n ----------\n D : ndarray(M1, N1)\n Original image\n dims : tuple(M2, N2)\n The dimensions to which to resize\n kind : string\n The kind of interpolation to use\n use_scipy...
Resize a floating point image Parameters ---------- D : ndarray(M1, N1) Original image dims : tuple(M2, N2) The dimensions to which to resize kind : string The kind of interpolation to use use_scipy : boolean Fall back to scipy.misc.imresize. This is a bad idea because it casts everything to uint8,...
CSMSSMTools.py
imresize
jagpreet1058/CoverSongIdentification
20
python
def imresize(D, dims, kind='cubic', use_scipy=False): "\n Resize a floating point image\n Parameters\n ----------\n D : ndarray(M1, N1)\n Original image\n dims : tuple(M2, N2)\n The dimensions to which to resize\n kind : string\n The kind of interpolation to use\n use_scipy...
def imresize(D, dims, kind='cubic', use_scipy=False): "\n Resize a floating point image\n Parameters\n ----------\n D : ndarray(M1, N1)\n Original image\n dims : tuple(M2, N2)\n The dimensions to which to resize\n kind : string\n The kind of interpolation to use\n use_scipy...
a837d1974d38df51849caecefa7c84fb6f6c3f747b82cabf021f679379f81b3d
def getSSM(X, DPixels, doPlot=False): '\n Compute a Euclidean self-similarity image between a set of points\n :param X: An Nxd matrix holding the d coordinates of N points\n :param DPixels: The image will be resized to this dimensions\n :param doPlot: If true, show a plot comparing the original/resized ...
Compute a Euclidean self-similarity image between a set of points :param X: An Nxd matrix holding the d coordinates of N points :param DPixels: The image will be resized to this dimensions :param doPlot: If true, show a plot comparing the original/resized images :return: A tuple (D, DResized)
CSMSSMTools.py
getSSM
jagpreet1058/CoverSongIdentification
20
python
def getSSM(X, DPixels, doPlot=False): '\n Compute a Euclidean self-similarity image between a set of points\n :param X: An Nxd matrix holding the d coordinates of N points\n :param DPixels: The image will be resized to this dimensions\n :param doPlot: If true, show a plot comparing the original/resized ...
def getSSM(X, DPixels, doPlot=False): '\n Compute a Euclidean self-similarity image between a set of points\n :param X: An Nxd matrix holding the d coordinates of N points\n :param DPixels: The image will be resized to this dimensions\n :param doPlot: If true, show a plot comparing the original/resized ...
d5f3648f50a0f739bb782a69b0ea7bf03a8cac7149a4b735f31abf7dfded145a
def getSSMAltMetric(X, A, DPixels, doPlot=False): '\n Compute a self-similarity matrix under an alternative metric specified\n by the symmetric positive definite matrix A^TA, so that the squared\n Euclidean distance under this metric between two vectors x and y is\n (x-y)^T*A^T*A*(x-y)\n :param X: An...
Compute a self-similarity matrix under an alternative metric specified by the symmetric positive definite matrix A^TA, so that the squared Euclidean distance under this metric between two vectors x and y is (x-y)^T*A^T*A*(x-y) :param X: An Nxd matrix holding the d coordinates of N points :param DPixels: The image will ...
CSMSSMTools.py
getSSMAltMetric
jagpreet1058/CoverSongIdentification
20
python
def getSSMAltMetric(X, A, DPixels, doPlot=False): '\n Compute a self-similarity matrix under an alternative metric specified\n by the symmetric positive definite matrix A^TA, so that the squared\n Euclidean distance under this metric between two vectors x and y is\n (x-y)^T*A^T*A*(x-y)\n :param X: An...
def getSSMAltMetric(X, A, DPixels, doPlot=False): '\n Compute a self-similarity matrix under an alternative metric specified\n by the symmetric positive definite matrix A^TA, so that the squared\n Euclidean distance under this metric between two vectors x and y is\n (x-y)^T*A^T*A*(x-y)\n :param X: An...
9f933df24164e5a8c60313168b297db0dde1e1a7a6bc42de5a7860de9961ab13
def getCSM(X, Y): '\n Return the Euclidean cross-similarity matrix between the M points\n in the Mxd matrix X and the N points in the Nxd matrix Y.\n :param X: An Mxd matrix holding the coordinates of M points\n :param Y: An Nxd matrix holding the coordinates of N points\n :return D: An MxN Euclidean...
Return the Euclidean cross-similarity matrix between the M points in the Mxd matrix X and the N points in the Nxd matrix Y. :param X: An Mxd matrix holding the coordinates of M points :param Y: An Nxd matrix holding the coordinates of N points :return D: An MxN Euclidean cross-similarity matrix
CSMSSMTools.py
getCSM
jagpreet1058/CoverSongIdentification
20
python
def getCSM(X, Y): '\n Return the Euclidean cross-similarity matrix between the M points\n in the Mxd matrix X and the N points in the Nxd matrix Y.\n :param X: An Mxd matrix holding the coordinates of M points\n :param Y: An Nxd matrix holding the coordinates of N points\n :return D: An MxN Euclidean...
def getCSM(X, Y): '\n Return the Euclidean cross-similarity matrix between the M points\n in the Mxd matrix X and the N points in the Nxd matrix Y.\n :param X: An Mxd matrix holding the coordinates of M points\n :param Y: An Nxd matrix holding the coordinates of N points\n :return D: An MxN Euclidean...
5852bc37fbda92ec6378f1864ffc10e9bcb6786b7a014b1acc9482e0896958bd
def getCSMEMD1D(X, Y): "\n Compute an approximate of the earth mover's distance\n between the M points in the Mxd matrix X and the N points\n in the Nxd matrix Y\n :param X: Mxd matrix\n :param Y: Nxd matrix\n :return D: An MxN distance matrix\n " M = X.shape[0] N = Y.shape[0] K = X...
Compute an approximate of the earth mover's distance between the M points in the Mxd matrix X and the N points in the Nxd matrix Y :param X: Mxd matrix :param Y: Nxd matrix :return D: An MxN distance matrix
CSMSSMTools.py
getCSMEMD1D
jagpreet1058/CoverSongIdentification
20
python
def getCSMEMD1D(X, Y): "\n Compute an approximate of the earth mover's distance\n between the M points in the Mxd matrix X and the N points\n in the Nxd matrix Y\n :param X: Mxd matrix\n :param Y: Nxd matrix\n :return D: An MxN distance matrix\n " M = X.shape[0] N = Y.shape[0] K = X...
def getCSMEMD1D(X, Y): "\n Compute an approximate of the earth mover's distance\n between the M points in the Mxd matrix X and the N points\n in the Nxd matrix Y\n :param X: Mxd matrix\n :param Y: Nxd matrix\n :return D: An MxN distance matrix\n " M = X.shape[0] N = Y.shape[0] K = X...
90f98e8bf94e1477a23a68da5a9bc8ff0544d170268abc43d38fb441cd046341
def getCSMCosine(X, Y): '\n Return the cosine distance between all vectors in X\n and all vectors in Y\n :param X: Mxd matrix\n :param Y: Nxd matrix\n :return D: An MxN distance matrix\n ' XNorm = np.sqrt(np.sum((X ** 2), 1)) XNorm[(XNorm == 0)] = 1 YNorm = np.sqrt(np.sum((Y ** 2), 1))...
Return the cosine distance between all vectors in X and all vectors in Y :param X: Mxd matrix :param Y: Nxd matrix :return D: An MxN distance matrix
CSMSSMTools.py
getCSMCosine
jagpreet1058/CoverSongIdentification
20
python
def getCSMCosine(X, Y): '\n Return the cosine distance between all vectors in X\n and all vectors in Y\n :param X: Mxd matrix\n :param Y: Nxd matrix\n :return D: An MxN distance matrix\n ' XNorm = np.sqrt(np.sum((X ** 2), 1)) XNorm[(XNorm == 0)] = 1 YNorm = np.sqrt(np.sum((Y ** 2), 1))...
def getCSMCosine(X, Y): '\n Return the cosine distance between all vectors in X\n and all vectors in Y\n :param X: Mxd matrix\n :param Y: Nxd matrix\n :return D: An MxN distance matrix\n ' XNorm = np.sqrt(np.sum((X ** 2), 1)) XNorm[(XNorm == 0)] = 1 YNorm = np.sqrt(np.sum((Y ** 2), 1))...
8085568c4eb34eda5e14eb62072764469489ddea41e056211cf9f63db5265390
def getOTI(C1, C2, doPlot=False): '\n Get the optimial transposition of the first chroma vector\n with respect to the second one\n :param C1: Chroma vector 1\n :param C2: Chroma vector 2\n :param doPlot: Plot the agreements over all shifts\n :returns: An index by which to rotate the first chroma v...
Get the optimial transposition of the first chroma vector with respect to the second one :param C1: Chroma vector 1 :param C2: Chroma vector 2 :param doPlot: Plot the agreements over all shifts :returns: An index by which to rotate the first chroma vector to match with the second
CSMSSMTools.py
getOTI
jagpreet1058/CoverSongIdentification
20
python
def getOTI(C1, C2, doPlot=False): '\n Get the optimial transposition of the first chroma vector\n with respect to the second one\n :param C1: Chroma vector 1\n :param C2: Chroma vector 2\n :param doPlot: Plot the agreements over all shifts\n :returns: An index by which to rotate the first chroma v...
def getOTI(C1, C2, doPlot=False): '\n Get the optimial transposition of the first chroma vector\n with respect to the second one\n :param C1: Chroma vector 1\n :param C2: Chroma vector 2\n :param doPlot: Plot the agreements over all shifts\n :returns: An index by which to rotate the first chroma v...
242e22959e0aac9aa37af19a2e6321aefbf51b94533427f424a15d5c3ae79a6f
def getCSMCosineOTI(X, Y, C1, C2): '\n Get the cosine distance between each row of X\n and each row of Y after doing a global optimal\n transposition change from X to Y\n :param X: Mxd matrix\n :param Y: Nxd matrix\n :param C1: Global chroma vector 1\n :param C2: Global chroma vector 2\n :re...
Get the cosine distance between each row of X and each row of Y after doing a global optimal transposition change from X to Y :param X: Mxd matrix :param Y: Nxd matrix :param C1: Global chroma vector 1 :param C2: Global chroma vector 2 :return D: An MxN distance matrix
CSMSSMTools.py
getCSMCosineOTI
jagpreet1058/CoverSongIdentification
20
python
def getCSMCosineOTI(X, Y, C1, C2): '\n Get the cosine distance between each row of X\n and each row of Y after doing a global optimal\n transposition change from X to Y\n :param X: Mxd matrix\n :param Y: Nxd matrix\n :param C1: Global chroma vector 1\n :param C2: Global chroma vector 2\n :re...
def getCSMCosineOTI(X, Y, C1, C2): '\n Get the cosine distance between each row of X\n and each row of Y after doing a global optimal\n transposition change from X to Y\n :param X: Mxd matrix\n :param Y: Nxd matrix\n :param C1: Global chroma vector 1\n :param C2: Global chroma vector 2\n :re...
0fc3a524d1eb7da46ca2325c121322738fbd7f3b2b6dd04fe6dfa20343bf7d84
def CSMToBinary(D, Kappa): '\n Turn a cross-similarity matrix into a binary cross-simlarity matrix, using partitions instead of\n nearest neighbors for speed\n :param D: M x N cross-similarity matrix\n :param Kappa:\n If Kappa = 0, take all neighbors\n If Kappa < 1 it is the fraction of mu...
Turn a cross-similarity matrix into a binary cross-simlarity matrix, using partitions instead of nearest neighbors for speed :param D: M x N cross-similarity matrix :param Kappa: If Kappa = 0, take all neighbors If Kappa < 1 it is the fraction of mutual neighbors to consider Otherwise Kappa is the number of...
CSMSSMTools.py
CSMToBinary
jagpreet1058/CoverSongIdentification
20
python
def CSMToBinary(D, Kappa): '\n Turn a cross-similarity matrix into a binary cross-simlarity matrix, using partitions instead of\n nearest neighbors for speed\n :param D: M x N cross-similarity matrix\n :param Kappa:\n If Kappa = 0, take all neighbors\n If Kappa < 1 it is the fraction of mu...
def CSMToBinary(D, Kappa): '\n Turn a cross-similarity matrix into a binary cross-simlarity matrix, using partitions instead of\n nearest neighbors for speed\n :param D: M x N cross-similarity matrix\n :param Kappa:\n If Kappa = 0, take all neighbors\n If Kappa < 1 it is the fraction of mu...
9ddf09de21a4a0f0b840af32209894c2bb49029a8c92d934c0b5ca5ee388dbb8
def CSMToBinaryMutual(D, Kappa): '\n Take the binary AND between the nearest neighbors in one\n direction and the other\n :param D: MxN cross-similarity matrix\n :param Kappa: (as in CSMToBinary)\n :returns B: MxN mutual binary cross-similarity matrix\n ' B1 = CSMToBinary(D, Kappa) B2 = CS...
Take the binary AND between the nearest neighbors in one direction and the other :param D: MxN cross-similarity matrix :param Kappa: (as in CSMToBinary) :returns B: MxN mutual binary cross-similarity matrix
CSMSSMTools.py
CSMToBinaryMutual
jagpreet1058/CoverSongIdentification
20
python
def CSMToBinaryMutual(D, Kappa): '\n Take the binary AND between the nearest neighbors in one\n direction and the other\n :param D: MxN cross-similarity matrix\n :param Kappa: (as in CSMToBinary)\n :returns B: MxN mutual binary cross-similarity matrix\n ' B1 = CSMToBinary(D, Kappa) B2 = CS...
def CSMToBinaryMutual(D, Kappa): '\n Take the binary AND between the nearest neighbors in one\n direction and the other\n :param D: MxN cross-similarity matrix\n :param Kappa: (as in CSMToBinary)\n :returns B: MxN mutual binary cross-similarity matrix\n ' B1 = CSMToBinary(D, Kappa) B2 = CS...
9d4191ef1d178ad438e411aa5b7c7e750cd00633044544668b796a2eaed44f5d
def getCSMType(Features1, O1, Features2, O2, Type): '\n A wrapper around all of the cross-similarity functions\n which automatically determines which one to use based\n on the type passed in\n ' if (Type == 'Euclidean'): return getCSM(Features1, Features2) elif (Type == 'Cosine'): ...
A wrapper around all of the cross-similarity functions which automatically determines which one to use based on the type passed in
CSMSSMTools.py
getCSMType
jagpreet1058/CoverSongIdentification
20
python
def getCSMType(Features1, O1, Features2, O2, Type): '\n A wrapper around all of the cross-similarity functions\n which automatically determines which one to use based\n on the type passed in\n ' if (Type == 'Euclidean'): return getCSM(Features1, Features2) elif (Type == 'Cosine'): ...
def getCSMType(Features1, O1, Features2, O2, Type): '\n A wrapper around all of the cross-similarity functions\n which automatically determines which one to use based\n on the type passed in\n ' if (Type == 'Euclidean'): return getCSM(Features1, Features2) elif (Type == 'Cosine'): ...
57da41cf0f0ab772ede57017a52977369999f4828027ca7c8554dc775a5ed536
def getCSMSmithWatermanScores(Features1, O1, Features2, O2, Kappa, Type, doPlot=False): "\n Compute the Smith Waterman score between two songs\n using a single feature set\n :param Features1: Mxk matrix of features in song 1\n :param O1: Auxiliary info for song 1\n :param Features2: Nxk matrix of fea...
Compute the Smith Waterman score between two songs using a single feature set :param Features1: Mxk matrix of features in song 1 :param O1: Auxiliary info for song 1 :param Features2: Nxk matrix of features in song 2 :param O2: Auxiliary info for song 2 :param Kappa: Nearest neighbors param for CSM :param Type: Type of...
CSMSSMTools.py
getCSMSmithWatermanScores
jagpreet1058/CoverSongIdentification
20
python
def getCSMSmithWatermanScores(Features1, O1, Features2, O2, Kappa, Type, doPlot=False): "\n Compute the Smith Waterman score between two songs\n using a single feature set\n :param Features1: Mxk matrix of features in song 1\n :param O1: Auxiliary info for song 1\n :param Features2: Nxk matrix of fea...
def getCSMSmithWatermanScores(Features1, O1, Features2, O2, Kappa, Type, doPlot=False): "\n Compute the Smith Waterman score between two songs\n using a single feature set\n :param Features1: Mxk matrix of features in song 1\n :param O1: Auxiliary info for song 1\n :param Features2: Nxk matrix of fea...
4cb8e0eebff3c603317b4b27f7c0facb7ac9e7c7f752382a0d633f9930498a8b
def getCSMSmithWatermanScoresORMerge(AllFeatures1, O1, AllFeatures2, O2, Kappa, CSMTypes, doPlot=False): "\n Compute the Smith Waterman score between two songs\n after doing a binary OR on individual feature sets\n :param AllFeatures1: A dictionary of Mxk matric of\n features in song 1\n :param O...
Compute the Smith Waterman score between two songs after doing a binary OR on individual feature sets :param AllFeatures1: A dictionary of Mxk matric of features in song 1 :param O1: Auxiliary info for song 1 :param AllFeatures2: A dictionary of Nxk matrix of features in song 2 :param O2: Auxiliary info for son...
CSMSSMTools.py
getCSMSmithWatermanScoresORMerge
jagpreet1058/CoverSongIdentification
20
python
def getCSMSmithWatermanScoresORMerge(AllFeatures1, O1, AllFeatures2, O2, Kappa, CSMTypes, doPlot=False): "\n Compute the Smith Waterman score between two songs\n after doing a binary OR on individual feature sets\n :param AllFeatures1: A dictionary of Mxk matric of\n features in song 1\n :param O...
def getCSMSmithWatermanScoresORMerge(AllFeatures1, O1, AllFeatures2, O2, Kappa, CSMTypes, doPlot=False): "\n Compute the Smith Waterman score between two songs\n after doing a binary OR on individual feature sets\n :param AllFeatures1: A dictionary of Mxk matric of\n features in song 1\n :param O...
d09cef52a0f9feb2a2f2d65a54844e6b2b8a5b8cfaf7e174273e972047d4e5fd
def getCSMSmithWatermanScoresEarlyFusionFull(AllFeatures1, O1, AllFeatures2, O2, Kappa, K, NIters, CSMTypes, doPlot=False, conservative=False): "\n Compute the Smith Waterman score between two songs\n after doing early similarity network fusion on\n individual feature sets\n :param AllFeatures1: A dicti...
Compute the Smith Waterman score between two songs after doing early similarity network fusion on individual feature sets :param AllFeatures1: A dictionary of Mxk matric of features in song 1 :param O1: Auxiliary info for song 1 :param AllFeatures2: A dictionary of Nxk matrix of features in song 2 :param O2: Au...
CSMSSMTools.py
getCSMSmithWatermanScoresEarlyFusionFull
jagpreet1058/CoverSongIdentification
20
python
def getCSMSmithWatermanScoresEarlyFusionFull(AllFeatures1, O1, AllFeatures2, O2, Kappa, K, NIters, CSMTypes, doPlot=False, conservative=False): "\n Compute the Smith Waterman score between two songs\n after doing early similarity network fusion on\n individual feature sets\n :param AllFeatures1: A dicti...
def getCSMSmithWatermanScoresEarlyFusionFull(AllFeatures1, O1, AllFeatures2, O2, Kappa, K, NIters, CSMTypes, doPlot=False, conservative=False): "\n Compute the Smith Waterman score between two songs\n after doing early similarity network fusion on\n individual feature sets\n :param AllFeatures1: A dicti...
cb37c369a891bcfe32f85c7c8faa485ba6df1f6c9a15b8a081d0cbbe7ed4fcc6
def getCSMSmithWatermanScoresEarlyFusion(AllFeatures1, O1, AllFeatures2, O2, Kappa, K, NIters, CSMTypes, doPlot=False): '\n Just return the score from getCSMSmithWatermanScoresEarlyFusionFull,\n using the same parameters\n ' return getCSMSmithWatermanScoresEarlyFusionFull(AllFeatures1, O1, AllFeatures2...
Just return the score from getCSMSmithWatermanScoresEarlyFusionFull, using the same parameters
CSMSSMTools.py
getCSMSmithWatermanScoresEarlyFusion
jagpreet1058/CoverSongIdentification
20
python
def getCSMSmithWatermanScoresEarlyFusion(AllFeatures1, O1, AllFeatures2, O2, Kappa, K, NIters, CSMTypes, doPlot=False): '\n Just return the score from getCSMSmithWatermanScoresEarlyFusionFull,\n using the same parameters\n ' return getCSMSmithWatermanScoresEarlyFusionFull(AllFeatures1, O1, AllFeatures2...
def getCSMSmithWatermanScoresEarlyFusion(AllFeatures1, O1, AllFeatures2, O2, Kappa, K, NIters, CSMTypes, doPlot=False): '\n Just return the score from getCSMSmithWatermanScoresEarlyFusionFull,\n using the same parameters\n ' return getCSMSmithWatermanScoresEarlyFusionFull(AllFeatures1, O1, AllFeatures2...
37d23fe9fd4c8fd82eda7d5c758203bbc6de2ef92cc5a38f7632de0a88b6b017
def get_event(self): '\n Execute at the beginning of each cycle of every loop.\n ' self.event_list = pygame.event.get() if self.match_event_type(QUIT): ' always check exit ' self._parent_game.quit_game() self.keys_pressed = pygame.key.get_pressed() self.mouse_button_sta...
Execute at the beginning of each cycle of every loop.
event_manager.py
get_event
Carcuis/pysnake
2
python
def get_event(self): '\n \n ' self.event_list = pygame.event.get() if self.match_event_type(QUIT): ' always check exit ' self._parent_game.quit_game() self.keys_pressed = pygame.key.get_pressed() self.mouse_button_status = pygame.mouse.get_pressed() self.mouse_pos =...
def get_event(self): '\n \n ' self.event_list = pygame.event.get() if self.match_event_type(QUIT): ' always check exit ' self._parent_game.quit_game() self.keys_pressed = pygame.key.get_pressed() self.mouse_button_status = pygame.mouse.get_pressed() self.mouse_pos =...
adb44ff42be145ad6c1db82add7c8be6573d49b3c022dcdc56dae0d6f6bc9efc
def check_key_or_button(self, event_type, attribute): '\n check if mouse button or keyboard key up or down\n :param event_type: mouse: MOUSEBUTTONDOWN or MOUSEBUTTONUP\n key: KEYDOWN or KEYUP\n :param attribute: (set or value) mouse: 1->left 2->middle 3->right 4->wheel...
check if mouse button or keyboard key up or down :param event_type: mouse: MOUSEBUTTONDOWN or MOUSEBUTTONUP key: KEYDOWN or KEYUP :param attribute: (set or value) mouse: 1->left 2->middle 3->right 4->wheel_up 5->wheel_down / key :return: bool: whether match event_type and button
event_manager.py
check_key_or_button
Carcuis/pysnake
2
python
def check_key_or_button(self, event_type, attribute): '\n check if mouse button or keyboard key up or down\n :param event_type: mouse: MOUSEBUTTONDOWN or MOUSEBUTTONUP\n key: KEYDOWN or KEYUP\n :param attribute: (set or value) mouse: 1->left 2->middle 3->right 4->wheel...
def check_key_or_button(self, event_type, attribute): '\n check if mouse button or keyboard key up or down\n :param event_type: mouse: MOUSEBUTTONDOWN or MOUSEBUTTONUP\n key: KEYDOWN or KEYUP\n :param attribute: (set or value) mouse: 1->left 2->middle 3->right 4->wheel...
b57417f6a6c164558116e4b72931d2dde58ffd627fcf208350c37ee2608b11b1
def early_stopping(self, loss: float) -> None: 'Counts how many consecutive losses are worse than current best.\n ' if (loss < self.current_best): self.current_best = loss self.patience_counter = 0 else: self.patience_counter += 1
Counts how many consecutive losses are worse than current best.
src/utils/trainer_jit.py
early_stopping
bask0/h2m
1
python
def early_stopping(self, loss: float) -> None: '\n ' if (loss < self.current_best): self.current_best = loss self.patience_counter = 0 else: self.patience_counter += 1
def early_stopping(self, loss: float) -> None: '\n ' if (loss < self.current_best): self.current_best = loss self.patience_counter = 0 else: self.patience_counter += 1<|docstring|>Counts how many consecutive losses are worse than current best.<|endoftext|>
0f1b2bb47d3f6d7e86e139ed17aff540e090f54498b1cc2c6128a383a139ce2a
def save(self, checkpoint: str) -> None: 'Saves the model at the provided checkpoint.\n\n Parameters\n ----------\n checkpoint\n Path to target checkpoint file.\n¨\n Returns\n ----------\n checkpoint\n\n ' savefile = os.path.join(checkpoint, 'chkp.pt')...
Saves the model at the provided checkpoint. Parameters ---------- checkpoint Path to target checkpoint file. ¨ Returns ---------- checkpoint
src/utils/trainer_jit.py
save
bask0/h2m
1
python
def save(self, checkpoint: str) -> None: 'Saves the model at the provided checkpoint.\n\n Parameters\n ----------\n checkpoint\n Path to target checkpoint file.\n¨\n Returns\n ----------\n checkpoint\n\n ' savefile = os.path.join(checkpoint, 'chkp.pt')...
def save(self, checkpoint: str) -> None: 'Saves the model at the provided checkpoint.\n\n Parameters\n ----------\n checkpoint\n Path to target checkpoint file.\n¨\n Returns\n ----------\n checkpoint\n\n ' savefile = os.path.join(checkpoint, 'chkp.pt')...
c8b2e896e0484bdfbfce84883af7be5eab14ac731fd9117b48ee98a3f558d836
def restore(self, checkpoint: str) -> None: 'Restores the model from a provided checkpoint.\n\n Parameters\n ----------\n filename\n Path to checkpoint file.\n\n ' checkpoint = torch.load(checkpoint) self.model.load_state_dict(checkpoint['model_state_dict']) self.m...
Restores the model from a provided checkpoint. Parameters ---------- filename Path to checkpoint file.
src/utils/trainer_jit.py
restore
bask0/h2m
1
python
def restore(self, checkpoint: str) -> None: 'Restores the model from a provided checkpoint.\n\n Parameters\n ----------\n filename\n Path to checkpoint file.\n\n ' checkpoint = torch.load(checkpoint) self.model.load_state_dict(checkpoint['model_state_dict']) self.m...
def restore(self, checkpoint: str) -> None: 'Restores the model from a provided checkpoint.\n\n Parameters\n ----------\n filename\n Path to checkpoint file.\n\n ' checkpoint = torch.load(checkpoint) self.model.load_state_dict(checkpoint['model_state_dict']) self.m...
796d1f7cb3c1a54cd0ed568e388bc8dd83736ee0488c09f938bf658a7212c374
def bin_reduce_(self, x: Dict[(str, torch.Tensor)], sample_set: str, fun: Callable=torch.mean) -> None: "Inplace reduction of tensors time dimension (dim 1).\n\n Parameters\n ----------\n x\n A dict of tensors of which all items with key in ``keys`` get reduced\n in time d...
Inplace reduction of tensors time dimension (dim 1). Parameters ---------- x A dict of tensors of which all items with key in ``keys`` get reduced in time dimension to match target resolution. The reduced items are added to the passed dicts with ``key`` as key prefix. The tensors must be of shape (batc...
src/utils/trainer_jit.py
bin_reduce_
bask0/h2m
1
python
def bin_reduce_(self, x: Dict[(str, torch.Tensor)], sample_set: str, fun: Callable=torch.mean) -> None: "Inplace reduction of tensors time dimension (dim 1).\n\n Parameters\n ----------\n x\n A dict of tensors of which all items with key in ``keys`` get reduced\n in time d...
def bin_reduce_(self, x: Dict[(str, torch.Tensor)], sample_set: str, fun: Callable=torch.mean) -> None: "Inplace reduction of tensors time dimension (dim 1).\n\n Parameters\n ----------\n x\n A dict of tensors of which all items with key in ``keys`` get reduced\n in time d...
d9e1820b0cc8920750f2faf6aa996e3b2949684f6480611c5e2ad9594c80ed90
def add_lr_metrics(self, metrics: Dict[(str, Any)]) -> None: 'Add learning rate log metrics.\n\n Parameters\n ----------\n metrics\n Metrics to logg\n lr\n The current learning rate.\n ' lr = self.scheduler.get_last_lr() if (lr is not None): i...
Add learning rate log metrics. Parameters ---------- metrics Metrics to logg lr The current learning rate.
src/utils/trainer_jit.py
add_lr_metrics
bask0/h2m
1
python
def add_lr_metrics(self, metrics: Dict[(str, Any)]) -> None: 'Add learning rate log metrics.\n\n Parameters\n ----------\n metrics\n Metrics to logg\n lr\n The current learning rate.\n ' lr = self.scheduler.get_last_lr() if (lr is not None): i...
def add_lr_metrics(self, metrics: Dict[(str, Any)]) -> None: 'Add learning rate log metrics.\n\n Parameters\n ----------\n metrics\n Metrics to logg\n lr\n The current learning rate.\n ' lr = self.scheduler.get_last_lr() if (lr is not None): i...
5973aa4e9ac97ce4df579a652e1cc40d7d19d1c696af9057c87ddb9d47096812
def cluster_acc(y_true, y_pred): '\n Calculate clustering accuracy. Require scikit-learn installed\n\n # Arguments\n y: true labels, numpy.array with shape `(n_samples,)`\n y_pred: predicted labels, numpy.array with shape `(n_samples,)`\n\n # Return\n accuracy, in [0,1]\n ' y_tr...
Calculate clustering accuracy. Require scikit-learn installed # Arguments y: true labels, numpy.array with shape `(n_samples,)` y_pred: predicted labels, numpy.array with shape `(n_samples,)` # Return accuracy, in [0,1]
utils/util.py
cluster_acc
zhunzhong07/NCL
45
python
def cluster_acc(y_true, y_pred): '\n Calculate clustering accuracy. Require scikit-learn installed\n\n # Arguments\n y: true labels, numpy.array with shape `(n_samples,)`\n y_pred: predicted labels, numpy.array with shape `(n_samples,)`\n\n # Return\n accuracy, in [0,1]\n ' y_tr...
def cluster_acc(y_true, y_pred): '\n Calculate clustering accuracy. Require scikit-learn installed\n\n # Arguments\n y: true labels, numpy.array with shape `(n_samples,)`\n y_pred: predicted labels, numpy.array with shape `(n_samples,)`\n\n # Return\n accuracy, in [0,1]\n ' y_tr...
9ac58a8c4ae439d17a2757c8892bef929aedaf58ff23f1ab2a5e08670d55f6f2
def accuracy(output, target, topk=(1,)): 'Computes the accuracy over the k top predictions for the specified values of k' with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) (_, pred) = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(targ...
Computes the accuracy over the k top predictions for the specified values of k
utils/util.py
accuracy
zhunzhong07/NCL
45
python
def accuracy(output, target, topk=(1,)): with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) (_, pred) = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, (- 1)).expand_as(pred)) res = [] for k in topk: ...
def accuracy(output, target, topk=(1,)): with torch.no_grad(): maxk = max(topk) batch_size = target.size(0) (_, pred) = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, (- 1)).expand_as(pred)) res = [] for k in topk: ...
a77904ade2c9cc1ac56f9395f7ac1696fadae568568af1599d8c710d847326eb
def check_root(): '\n Check if program is lauched with root privileges\n :return:\n ' logging.info('Checking permissions...') if (not (os.geteuid() == 0)): logging.warning('IoT-SecurityChecker must be run as root or with sudo privileges... Exiting') exit(1) logging.info(((G + 'P...
Check if program is lauched with root privileges :return:
Utils.py
check_root
c0mix/IoT-SecurityChecker
13
python
def check_root(): '\n Check if program is lauched with root privileges\n :return:\n ' logging.info('Checking permissions...') if (not (os.geteuid() == 0)): logging.warning('IoT-SecurityChecker must be run as root or with sudo privileges... Exiting') exit(1) logging.info(((G + 'P...
def check_root(): '\n Check if program is lauched with root privileges\n :return:\n ' logging.info('Checking permissions...') if (not (os.geteuid() == 0)): logging.warning('IoT-SecurityChecker must be run as root or with sudo privileges... Exiting') exit(1) logging.info(((G + 'P...
ba61f062cd0fd2dcb947639f0f34f47216779f0d064a61ad0fefe1e349461731
def check_test_args(arg, key): '\n Check if a bruteforce can be launched or not\n :param args: list\n :param key: string\n :return: boolean\n ' if (arg == None): return False for i in arg[0].split(','): if ((i.upper() == key.upper()) or (i.upper() == 'ALL')): retur...
Check if a bruteforce can be launched or not :param args: list :param key: string :return: boolean
Utils.py
check_test_args
c0mix/IoT-SecurityChecker
13
python
def check_test_args(arg, key): '\n Check if a bruteforce can be launched or not\n :param args: list\n :param key: string\n :return: boolean\n ' if (arg == None): return False for i in arg[0].split(','): if ((i.upper() == key.upper()) or (i.upper() == 'ALL')): retur...
def check_test_args(arg, key): '\n Check if a bruteforce can be launched or not\n :param args: list\n :param key: string\n :return: boolean\n ' if (arg == None): return False for i in arg[0].split(','): if ((i.upper() == key.upper()) or (i.upper() == 'ALL')): retur...
b816f958bf248d42d8babe25392f53e8391bf8a938156994c7f8b5ad4acd698f
def check_args(args): '\n check if important arguments are set\n :param args:\n :return:\n ' brute_choices = ['SSH', 'ALL', 'TELNET', 'FTP', 'HTTP', 'NONE'] if (args.bruteforce is not None): for a in args.bruteforce[0].split(','): if (a.upper() not in brute_choices): ...
check if important arguments are set :param args: :return:
Utils.py
check_args
c0mix/IoT-SecurityChecker
13
python
def check_args(args): '\n check if important arguments are set\n :param args:\n :return:\n ' brute_choices = ['SSH', 'ALL', 'TELNET', 'FTP', 'HTTP', 'NONE'] if (args.bruteforce is not None): for a in args.bruteforce[0].split(','): if (a.upper() not in brute_choices): ...
def check_args(args): '\n check if important arguments are set\n :param args:\n :return:\n ' brute_choices = ['SSH', 'ALL', 'TELNET', 'FTP', 'HTTP', 'NONE'] if (args.bruteforce is not None): for a in args.bruteforce[0].split(','): if (a.upper() not in brute_choices): ...
83e848da6692380862d7d47de2aebce1ee61ffc5ba8fcc634cbb54fc931204d3
def arg_parsing(): '\n Handle the arguments\n :return: list\n ' parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('target', help='Target list compatible with masscan range or a file with targets') parser.add_argument('-p', '--prefix', d...
Handle the arguments :return: list
Utils.py
arg_parsing
c0mix/IoT-SecurityChecker
13
python
def arg_parsing(): '\n Handle the arguments\n :return: list\n ' parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('target', help='Target list compatible with masscan range or a file with targets') parser.add_argument('-p', '--prefix', d...
def arg_parsing(): '\n Handle the arguments\n :return: list\n ' parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('target', help='Target list compatible with masscan range or a file with targets') parser.add_argument('-p', '--prefix', d...
01c49edb9ce83c666492bff3bac79ec00672ad8617f21bfc51e730b9f71de34f
def print_banner(): '\n just print banner title\n :return:\n ' os.system('cat resources/logo') print('\n')
just print banner title :return:
Utils.py
print_banner
c0mix/IoT-SecurityChecker
13
python
def print_banner(): '\n just print banner title\n :return:\n ' os.system('cat resources/logo') print('\n')
def print_banner(): '\n just print banner title\n :return:\n ' os.system('cat resources/logo') print('\n')<|docstring|>just print banner title :return:<|endoftext|>
d072032692a23bc2be264b9cea13033db120ea3b182754dcff627caafc964de1
def reject_next_to(env, pos): "\n Function to filter out object positions that are right next to\n the agent's starting point\n " (sx, sy) = env.agent_pos (x, y) = pos d = (abs((sx - x)) + abs((sy - y))) return (d < 2)
Function to filter out object positions that are right next to the agent's starting point
gym_minigrid/roomgrid.py
reject_next_to
natvern/gym-minigrid
1,475
python
def reject_next_to(env, pos): "\n Function to filter out object positions that are right next to\n the agent's starting point\n " (sx, sy) = env.agent_pos (x, y) = pos d = (abs((sx - x)) + abs((sy - y))) return (d < 2)
def reject_next_to(env, pos): "\n Function to filter out object positions that are right next to\n the agent's starting point\n " (sx, sy) = env.agent_pos (x, y) = pos d = (abs((sx - x)) + abs((sy - y))) return (d < 2)<|docstring|>Function to filter out object positions that are right next ...
5264ad79b395edd30c6bc6a437daf33538c76bf6eb6817a96a6e321adaa04dac
def pos_inside(self, x, y): '\n Check if a position is within the bounds of this room\n ' (topX, topY) = self.top (sizeX, sizeY) = self.size if ((x < topX) or (y < topY)): return False if ((x >= (topX + sizeX)) or (y >= (topY + sizeY))): return False return True
Check if a position is within the bounds of this room
gym_minigrid/roomgrid.py
pos_inside
natvern/gym-minigrid
1,475
python
def pos_inside(self, x, y): '\n \n ' (topX, topY) = self.top (sizeX, sizeY) = self.size if ((x < topX) or (y < topY)): return False if ((x >= (topX + sizeX)) or (y >= (topY + sizeY))): return False return True
def pos_inside(self, x, y): '\n \n ' (topX, topY) = self.top (sizeX, sizeY) = self.size if ((x < topX) or (y < topY)): return False if ((x >= (topX + sizeX)) or (y >= (topY + sizeY))): return False return True<|docstring|>Check if a position is within the bounds of ...
15afda9ab355cd33397530ceae341f330229df3514a0166a174af116b64db68c
def room_from_pos(self, x, y): 'Get the room a given position maps to' assert (x >= 0) assert (y >= 0) i = (x // (self.room_size - 1)) j = (y // (self.room_size - 1)) assert (i < self.num_cols) assert (j < self.num_rows) return self.room_grid[j][i]
Get the room a given position maps to
gym_minigrid/roomgrid.py
room_from_pos
natvern/gym-minigrid
1,475
python
def room_from_pos(self, x, y): assert (x >= 0) assert (y >= 0) i = (x // (self.room_size - 1)) j = (y // (self.room_size - 1)) assert (i < self.num_cols) assert (j < self.num_rows) return self.room_grid[j][i]
def room_from_pos(self, x, y): assert (x >= 0) assert (y >= 0) i = (x // (self.room_size - 1)) j = (y // (self.room_size - 1)) assert (i < self.num_cols) assert (j < self.num_rows) return self.room_grid[j][i]<|docstring|>Get the room a given position maps to<|endoftext|>
c330302e2e2917a5503ac9d50eea26ccb01c87134f827fcea29e4d0a2498d6f4
def place_in_room(self, i, j, obj): '\n Add an existing object to room (i, j)\n ' room = self.get_room(i, j) pos = self.place_obj(obj, room.top, room.size, reject_fn=reject_next_to, max_tries=1000) room.objs.append(obj) return (obj, pos)
Add an existing object to room (i, j)
gym_minigrid/roomgrid.py
place_in_room
natvern/gym-minigrid
1,475
python
def place_in_room(self, i, j, obj): '\n \n ' room = self.get_room(i, j) pos = self.place_obj(obj, room.top, room.size, reject_fn=reject_next_to, max_tries=1000) room.objs.append(obj) return (obj, pos)
def place_in_room(self, i, j, obj): '\n \n ' room = self.get_room(i, j) pos = self.place_obj(obj, room.top, room.size, reject_fn=reject_next_to, max_tries=1000) room.objs.append(obj) return (obj, pos)<|docstring|>Add an existing object to room (i, j)<|endoftext|>
3599c4381c3155cc285c3aa8cb12550db93121ad038301d8ff21654d3910d471
def add_object(self, i, j, kind=None, color=None): '\n Add a new object to room (i, j)\n ' if (kind == None): kind = self._rand_elem(['key', 'ball', 'box']) if (color == None): color = self._rand_color() assert (kind in ['key', 'ball', 'box']) if (kind == 'key'): ...
Add a new object to room (i, j)
gym_minigrid/roomgrid.py
add_object
natvern/gym-minigrid
1,475
python
def add_object(self, i, j, kind=None, color=None): '\n \n ' if (kind == None): kind = self._rand_elem(['key', 'ball', 'box']) if (color == None): color = self._rand_color() assert (kind in ['key', 'ball', 'box']) if (kind == 'key'): obj = Key(color) elif (ki...
def add_object(self, i, j, kind=None, color=None): '\n \n ' if (kind == None): kind = self._rand_elem(['key', 'ball', 'box']) if (color == None): color = self._rand_color() assert (kind in ['key', 'ball', 'box']) if (kind == 'key'): obj = Key(color) elif (ki...
46e9f26512832fb93d8e2f0d75c2e85a7697e2fc8338644ae201a46c734ae0f9
def add_door(self, i, j, door_idx=None, color=None, locked=None): '\n Add a door to a room, connecting it to a neighbor\n ' room = self.get_room(i, j) if (door_idx == None): while True: door_idx = self._rand_int(0, 4) if (room.neighbors[door_idx] and (room.doors...
Add a door to a room, connecting it to a neighbor
gym_minigrid/roomgrid.py
add_door
natvern/gym-minigrid
1,475
python
def add_door(self, i, j, door_idx=None, color=None, locked=None): '\n \n ' room = self.get_room(i, j) if (door_idx == None): while True: door_idx = self._rand_int(0, 4) if (room.neighbors[door_idx] and (room.doors[door_idx] is None)): break i...
def add_door(self, i, j, door_idx=None, color=None, locked=None): '\n \n ' room = self.get_room(i, j) if (door_idx == None): while True: door_idx = self._rand_int(0, 4) if (room.neighbors[door_idx] and (room.doors[door_idx] is None)): break i...
a817f998dac256a6dd1e79d46fc492cf4c8f77d4eb63f7df6e192f0368c97009
def remove_wall(self, i, j, wall_idx): '\n Remove a wall between two rooms\n ' room = self.get_room(i, j) assert ((wall_idx >= 0) and (wall_idx < 4)) assert (room.doors[wall_idx] is None), 'door exists on this wall' assert room.neighbors[wall_idx], 'invalid wall' neighbor = room.ne...
Remove a wall between two rooms
gym_minigrid/roomgrid.py
remove_wall
natvern/gym-minigrid
1,475
python
def remove_wall(self, i, j, wall_idx): '\n \n ' room = self.get_room(i, j) assert ((wall_idx >= 0) and (wall_idx < 4)) assert (room.doors[wall_idx] is None), 'door exists on this wall' assert room.neighbors[wall_idx], 'invalid wall' neighbor = room.neighbors[wall_idx] (tx, ty) ...
def remove_wall(self, i, j, wall_idx): '\n \n ' room = self.get_room(i, j) assert ((wall_idx >= 0) and (wall_idx < 4)) assert (room.doors[wall_idx] is None), 'door exists on this wall' assert room.neighbors[wall_idx], 'invalid wall' neighbor = room.neighbors[wall_idx] (tx, ty) ...
106e75c77cc63326dcde5c828b7cec01ad854dff1beacfb44533cc4ec1a7d94f
def place_agent(self, i=None, j=None, rand_dir=True): '\n Place the agent in a room\n ' if (i == None): i = self._rand_int(0, self.num_cols) if (j == None): j = self._rand_int(0, self.num_rows) room = self.room_grid[j][i] while True: super().place_agent(room.top...
Place the agent in a room
gym_minigrid/roomgrid.py
place_agent
natvern/gym-minigrid
1,475
python
def place_agent(self, i=None, j=None, rand_dir=True): '\n \n ' if (i == None): i = self._rand_int(0, self.num_cols) if (j == None): j = self._rand_int(0, self.num_rows) room = self.room_grid[j][i] while True: super().place_agent(room.top, room.size, rand_dir, ma...
def place_agent(self, i=None, j=None, rand_dir=True): '\n \n ' if (i == None): i = self._rand_int(0, self.num_cols) if (j == None): j = self._rand_int(0, self.num_rows) room = self.room_grid[j][i] while True: super().place_agent(room.top, room.size, rand_dir, ma...
a0aee7634b2c79bbf88649ed3d8d7bf891f330bbd64137ddb1db26177443a287
def connect_all(self, door_colors=COLOR_NAMES, max_itrs=5000): '\n Make sure that all rooms are reachable by the agent from its\n starting position\n ' start_room = self.room_from_pos(*self.agent_pos) added_doors = [] def find_reach(): reach = set() stack = [start_r...
Make sure that all rooms are reachable by the agent from its starting position
gym_minigrid/roomgrid.py
connect_all
natvern/gym-minigrid
1,475
python
def connect_all(self, door_colors=COLOR_NAMES, max_itrs=5000): '\n Make sure that all rooms are reachable by the agent from its\n starting position\n ' start_room = self.room_from_pos(*self.agent_pos) added_doors = [] def find_reach(): reach = set() stack = [start_r...
def connect_all(self, door_colors=COLOR_NAMES, max_itrs=5000): '\n Make sure that all rooms are reachable by the agent from its\n starting position\n ' start_room = self.room_from_pos(*self.agent_pos) added_doors = [] def find_reach(): reach = set() stack = [start_r...
ae3fbc8da80f940cd1be2780727b0d2741346668460b2cd405dd68665ab77d3d
def add_distractors(self, i=None, j=None, num_distractors=10, all_unique=True): '\n Add random objects that can potentially distract/confuse the agent.\n ' objs = [] for row in self.room_grid: for room in row: for obj in room.objs: objs.append((obj.type, obj...
Add random objects that can potentially distract/confuse the agent.
gym_minigrid/roomgrid.py
add_distractors
natvern/gym-minigrid
1,475
python
def add_distractors(self, i=None, j=None, num_distractors=10, all_unique=True): '\n \n ' objs = [] for row in self.room_grid: for room in row: for obj in room.objs: objs.append((obj.type, obj.color)) dists = [] while (len(dists) < num_distractors): ...
def add_distractors(self, i=None, j=None, num_distractors=10, all_unique=True): '\n \n ' objs = [] for row in self.room_grid: for room in row: for obj in room.objs: objs.append((obj.type, obj.color)) dists = [] while (len(dists) < num_distractors): ...
4945bd96a3df356a3fbfd38f5b27c56a1e4706bf1680cde31b9ad997bef16820
def users_username_token_post(self, api_token, username, **kwargs): "Generates a user API token # noqa: E501\n\n Generates a new user API token. If the user already has a generated API token, generates a new one. Conditions to be able to perform the action: - To have the permission **ALL_USERS_UPDATE** gr...
Generates a user API token # noqa: E501 Generates a new user API token. If the user already has a generated API token, generates a new one. Conditions to be able to perform the action: - To have the permission **ALL_USERS_UPDATE** granted, or - To have the permission **MANAGE_USERS_BU** granted. Having this permi...
iriusrisk-python-client-lib/iriusrisk_python_client_lib/api/token_api.py
users_username_token_post
iriusrisk/iriusrisk-python-client-lib
0
python
def users_username_token_post(self, api_token, username, **kwargs): "Generates a user API token # noqa: E501\n\n Generates a new user API token. If the user already has a generated API token, generates a new one. Conditions to be able to perform the action: - To have the permission **ALL_USERS_UPDATE** gr...
def users_username_token_post(self, api_token, username, **kwargs): "Generates a user API token # noqa: E501\n\n Generates a new user API token. If the user already has a generated API token, generates a new one. Conditions to be able to perform the action: - To have the permission **ALL_USERS_UPDATE** gr...
eb018917793187caf66cd35d125e92ab173f7223211a7c4751ea4857c5783150
def users_username_token_post_with_http_info(self, api_token, username, **kwargs): "Generates a user API token # noqa: E501\n\n Generates a new user API token. If the user already has a generated API token, generates a new one. Conditions to be able to perform the action: - To have the permission **ALL_US...
Generates a user API token # noqa: E501 Generates a new user API token. If the user already has a generated API token, generates a new one. Conditions to be able to perform the action: - To have the permission **ALL_USERS_UPDATE** granted, or - To have the permission **MANAGE_USERS_BU** granted. Having this permi...
iriusrisk-python-client-lib/iriusrisk_python_client_lib/api/token_api.py
users_username_token_post_with_http_info
iriusrisk/iriusrisk-python-client-lib
0
python
def users_username_token_post_with_http_info(self, api_token, username, **kwargs): "Generates a user API token # noqa: E501\n\n Generates a new user API token. If the user already has a generated API token, generates a new one. Conditions to be able to perform the action: - To have the permission **ALL_US...
def users_username_token_post_with_http_info(self, api_token, username, **kwargs): "Generates a user API token # noqa: E501\n\n Generates a new user API token. If the user already has a generated API token, generates a new one. Conditions to be able to perform the action: - To have the permission **ALL_US...
d29a314639752e00adaba2d5c4ebad09a8ac8ac8e00cfe7a8743b0b799cb3d23
def setupConfigFileFramework(factoryReset=False): "\n 4 user manipulable config files can exist in the ${packages}/ShellRunner directory\n `- these are: ShellRunner.sublime-settings, Side Bar.sublime-menu\n - Context.sublime-menu, and Default (${platform}).sublime-keymap\n Each of these files has a cor...
4 user manipulable config files can exist in the ${packages}/ShellRunner directory `- these are: ShellRunner.sublime-settings, Side Bar.sublime-menu - Context.sublime-menu, and Default (${platform}).sublime-keymap Each of these files has a corresponding 'template' (blankish canvas) file, `- and a corresponding 'exampl...
ShellRunner.py
setupConfigFileFramework
phughes3866/ShellRunner
0
python
def setupConfigFileFramework(factoryReset=False): "\n 4 user manipulable config files can exist in the ${packages}/ShellRunner directory\n `- these are: ShellRunner.sublime-settings, Side Bar.sublime-menu\n - Context.sublime-menu, and Default (${platform}).sublime-keymap\n Each of these files has a cor...
def setupConfigFileFramework(factoryReset=False): "\n 4 user manipulable config files can exist in the ${packages}/ShellRunner directory\n `- these are: ShellRunner.sublime-settings, Side Bar.sublime-menu\n - Context.sublime-menu, and Default (${platform}).sublime-keymap\n Each of these files has a cor...
ec9fc47111dc70463631bdb85b691840da27475a89c02a40bab1fbbbad3b7583
def settingsUpdateByProject(projectFileShellRunnerSectionDict, projectFileName): "\n Overwrites global: activeSettings dict with entries from ShellRunner section\n `- of the active .sublime-project file.\n Note: As settings from .sublime-projects have higher priority than the\n 'ShellRunner.sublim...
Overwrites global: activeSettings dict with entries from ShellRunner section `- of the active .sublime-project file. Note: As settings from .sublime-projects have higher priority than the 'ShellRunner.sublime-settings' files, they can be directly written to 'activeSettings'
ShellRunner.py
settingsUpdateByProject
phughes3866/ShellRunner
0
python
def settingsUpdateByProject(projectFileShellRunnerSectionDict, projectFileName): "\n Overwrites global: activeSettings dict with entries from ShellRunner section\n `- of the active .sublime-project file.\n Note: As settings from .sublime-projects have higher priority than the\n 'ShellRunner.sublim...
def settingsUpdateByProject(projectFileShellRunnerSectionDict, projectFileName): "\n Overwrites global: activeSettings dict with entries from ShellRunner section\n `- of the active .sublime-project file.\n Note: As settings from .sublime-projects have higher priority than the\n 'ShellRunner.sublim...
7896894896e530a30ff1c10b39d2ded76fb318f7eada6d51c9f47ac1d3a85a80
def plugin_loaded(factoryReset=False): '\n 1. Sets up global: configFile dictionary + ensures necessary config files are in place\n 2. Loads initial set of ShellRunner settings into global: activeSettings dictionary\n ' global activeSettings global srSettings def readInUserSettings(): ...
1. Sets up global: configFile dictionary + ensures necessary config files are in place 2. Loads initial set of ShellRunner settings into global: activeSettings dictionary
ShellRunner.py
plugin_loaded
phughes3866/ShellRunner
0
python
def plugin_loaded(factoryReset=False): '\n 1. Sets up global: configFile dictionary + ensures necessary config files are in place\n 2. Loads initial set of ShellRunner settings into global: activeSettings dictionary\n ' global activeSettings global srSettings def readInUserSettings(): ...
def plugin_loaded(factoryReset=False): '\n 1. Sets up global: configFile dictionary + ensures necessary config files are in place\n 2. Loads initial set of ShellRunner settings into global: activeSettings dictionary\n ' global activeSettings global srSettings def readInUserSettings(): ...
a6a630adcff075cf26bec716bab6c33f1bd9454e051496191d6695f496f58f2d
def buildPathFileDirSidebarItemStrings(argsDict): '\n Build space separated string lists of \'files\', \'dirs\', \'paths\' from same-named lists available in args passed\n Sublime Text fills these optional sidebar menu args appropriately when they are given in a sidebar menu command:\n `- e.g. a list arg "...
Build space separated string lists of 'files', 'dirs', 'paths' from same-named lists available in args passed Sublime Text fills these optional sidebar menu args appropriately when they are given in a sidebar menu command: `- e.g. a list arg "dirs": [] will be filled in with a list of dirs currently selected in the sid...
ShellRunner.py
buildPathFileDirSidebarItemStrings
phughes3866/ShellRunner
0
python
def buildPathFileDirSidebarItemStrings(argsDict): '\n Build space separated string lists of \'files\', \'dirs\', \'paths\' from same-named lists available in args passed\n Sublime Text fills these optional sidebar menu args appropriately when they are given in a sidebar menu command:\n `- e.g. a list arg "...
def buildPathFileDirSidebarItemStrings(argsDict): '\n Build space separated string lists of \'files\', \'dirs\', \'paths\' from same-named lists available in args passed\n Sublime Text fills these optional sidebar menu args appropriately when they are given in a sidebar menu command:\n `- e.g. a list arg "...
ef712a2b68ba96ef63a4d0b4bee9aeafa5f81501c798b6589b02f7ca1b62564a
def is_anagram(word1, word2): 'Receives two words and returns True/False (boolean) if word2 is\n an anagram of word1, ignore case and spacing.\n About anagrams: https://en.wikipedia.org/wiki/Anagram' word1 = word1.strip().replace(' ', '').lower() word2 = word2.strip().replace(' ', '').lower() ...
Receives two words and returns True/False (boolean) if word2 is an anagram of word1, ignore case and spacing. About anagrams: https://en.wikipedia.org/wiki/Anagram
bites/bite122.py
is_anagram
ChidinmaKO/Chobe-bitesofpy
0
python
def is_anagram(word1, word2): 'Receives two words and returns True/False (boolean) if word2 is\n an anagram of word1, ignore case and spacing.\n About anagrams: https://en.wikipedia.org/wiki/Anagram' word1 = word1.strip().replace(' ', ).lower() word2 = word2.strip().replace(' ', ).lower() if...
def is_anagram(word1, word2): 'Receives two words and returns True/False (boolean) if word2 is\n an anagram of word1, ignore case and spacing.\n About anagrams: https://en.wikipedia.org/wiki/Anagram' word1 = word1.strip().replace(' ', ).lower() word2 = word2.strip().replace(' ', ).lower() if...
7562dffb534d7440ebc1e29d1cf23d06c9d32a71ba7a07fbd4943f067ebb1ba1
@njit def reservoir_step(x, dowy, Q, S, K, R_avg, S_avg): '\n Advances reservoir storage from one timestep to the next\n\n Parameters:\n x (np.array): Reservoir rule parameters (5)\n dowy (int): Day of water year\n Q (float): Inflow, cfs\n S (float): Storage, acre-feet\n K (float): Stor...
Advances reservoir storage from one timestep to the next Parameters: x (np.array): Reservoir rule parameters (5) dowy (int): Day of water year Q (float): Inflow, cfs S (float): Storage, acre-feet K (float): Storage capacity, acre-feet R_avg (float): Median release for this day of the year, cf...
model.py
reservoir_step
jdherman/ssjrb
5
python
@njit def reservoir_step(x, dowy, Q, S, K, R_avg, S_avg): '\n Advances reservoir storage from one timestep to the next\n\n Parameters:\n x (np.array): Reservoir rule parameters (5)\n dowy (int): Day of water year\n Q (float): Inflow, cfs\n S (float): Storage, acre-feet\n K (float): Stor...
@njit def reservoir_step(x, dowy, Q, S, K, R_avg, S_avg): '\n Advances reservoir storage from one timestep to the next\n\n Parameters:\n x (np.array): Reservoir rule parameters (5)\n dowy (int): Day of water year\n Q (float): Inflow, cfs\n S (float): Storage, acre-feet\n K (float): Stor...
2c9a635e84ff43561feaf0c7dab016c835397dd08e12c1e1d4ac41b9985bd6f7
@njit def reservoir_fit(x, dowy, Q, K, Q_avg, R_avg, R_obs, S_avg, S_obs): '\n Evaluate reservoir model against historical observations for a set of parameters \n\n Parameters:\n x (np.array): Reservoir rule parameters (5)\n dowy (np.array(int)): Day of water year over the simulation\n Q (np.arra...
Evaluate reservoir model against historical observations for a set of parameters Parameters: x (np.array): Reservoir rule parameters (5) dowy (np.array(int)): Day of water year over the simulation Q (np.array(float)): Inflow, cfs S (np.array(float)): Storage, acre-feet K (float): Storage capacit...
model.py
reservoir_fit
jdherman/ssjrb
5
python
@njit def reservoir_fit(x, dowy, Q, K, Q_avg, R_avg, R_obs, S_avg, S_obs): '\n Evaluate reservoir model against historical observations for a set of parameters \n\n Parameters:\n x (np.array): Reservoir rule parameters (5)\n dowy (np.array(int)): Day of water year over the simulation\n Q (np.arra...
@njit def reservoir_fit(x, dowy, Q, K, Q_avg, R_avg, R_obs, S_avg, S_obs): '\n Evaluate reservoir model against historical observations for a set of parameters \n\n Parameters:\n x (np.array): Reservoir rule parameters (5)\n dowy (np.array(int)): Day of water year over the simulation\n Q (np.arra...
a8f8a8afb53e7b89288040f4baf61e8e2335ecf3ba7aa1aa7fb0066b6300cb10
@njit def gains_step(x, dowy, Q_total, Q_total_avg, S_total_pct, Gains_avg): '\n Compute gains into the Delta for one timestep\n\n Parameters:\n x (np.array): Gains parameters (2)\n dowy (int): Day of water year\n Q_total (float): Total inflow to all reservoirs, cfs\n Q_total_avg (float): Av...
Compute gains into the Delta for one timestep Parameters: x (np.array): Gains parameters (2) dowy (int): Day of water year Q_total (float): Total inflow to all reservoirs, cfs Q_total_avg (float): Average total inflow for this day of the year, cfs S_total_pct (float): System-wide reservoir storag...
model.py
gains_step
jdherman/ssjrb
5
python
@njit def gains_step(x, dowy, Q_total, Q_total_avg, S_total_pct, Gains_avg): '\n Compute gains into the Delta for one timestep\n\n Parameters:\n x (np.array): Gains parameters (2)\n dowy (int): Day of water year\n Q_total (float): Total inflow to all reservoirs, cfs\n Q_total_avg (float): Av...
@njit def gains_step(x, dowy, Q_total, Q_total_avg, S_total_pct, Gains_avg): '\n Compute gains into the Delta for one timestep\n\n Parameters:\n x (np.array): Gains parameters (2)\n dowy (int): Day of water year\n Q_total (float): Total inflow to all reservoirs, cfs\n Q_total_avg (float): Av...
e45d264a492efbee3b60a6c82969063c2819748c8e386c05463b43515effe274
@njit def gains_fit(x, dowy, Q_total, Q_total_avg, S_total_pct, Gains_avg, Gains_obs): '\n Evaluate Delta gains model against historical observations for a set of parameters\n\n Parameters:\n x (np.array): Gains parameters (2)\n dowy (np.array(int)): Day of water year\n Q_total (np.array(float)):...
Evaluate Delta gains model against historical observations for a set of parameters Parameters: x (np.array): Gains parameters (2) dowy (np.array(int)): Day of water year Q_total (np.array(float)): Total inflow to all reservoirs, cfs Q_total_avg (np.array(float)): Average total inflow ...
model.py
gains_fit
jdherman/ssjrb
5
python
@njit def gains_fit(x, dowy, Q_total, Q_total_avg, S_total_pct, Gains_avg, Gains_obs): '\n Evaluate Delta gains model against historical observations for a set of parameters\n\n Parameters:\n x (np.array): Gains parameters (2)\n dowy (np.array(int)): Day of water year\n Q_total (np.array(float)):...
@njit def gains_fit(x, dowy, Q_total, Q_total_avg, S_total_pct, Gains_avg, Gains_obs): '\n Evaluate Delta gains model against historical observations for a set of parameters\n\n Parameters:\n x (np.array): Gains parameters (2)\n dowy (np.array(int)): Day of water year\n Q_total (np.array(float)):...
948ef23ca9ca572697fe5952246ef4bd7bc84cfa96a8b3de18335ec1da4b39c6
@njit def delta_step(x, dowy, Q_in, Pump_pct_avg, S_total_pct): '\n Compute total Delta pumping (Banks + Tracy) for one timestep\n\n Parameters:\n x (np.array): Delta pumping parameter (1)\n dowy (int): Day of water year\n Q_in (float): Total inflow to the Delta, cfs \n (sum of...
Compute total Delta pumping (Banks + Tracy) for one timestep Parameters: x (np.array): Delta pumping parameter (1) dowy (int): Day of water year Q_in (float): Total inflow to the Delta, cfs (sum of all reservoir outflows plus gains) Pump_pct_avg (float): (Average pumping / Average ...
model.py
delta_step
jdherman/ssjrb
5
python
@njit def delta_step(x, dowy, Q_in, Pump_pct_avg, S_total_pct): '\n Compute total Delta pumping (Banks + Tracy) for one timestep\n\n Parameters:\n x (np.array): Delta pumping parameter (1)\n dowy (int): Day of water year\n Q_in (float): Total inflow to the Delta, cfs \n (sum of...
@njit def delta_step(x, dowy, Q_in, Pump_pct_avg, S_total_pct): '\n Compute total Delta pumping (Banks + Tracy) for one timestep\n\n Parameters:\n x (np.array): Delta pumping parameter (1)\n dowy (int): Day of water year\n Q_in (float): Total inflow to the Delta, cfs \n (sum of...
a4071f49b89bc2f5cfcb13e4b2062de042c93227735e3b37fb7894e075870dd7
@njit def delta_fit(x, dowy, Q_in, Pump_pct_avg, S_total_pct, Pump_obs): '\n Evaluate Delta pumping model against historical observations for a set of parameters\n\n Parameters:\n x (np.array): Delta pumping parameter (1)\n dowy (np.array(int)): Day of water year\n Q_in (np.array(float)): Total i...
Evaluate Delta pumping model against historical observations for a set of parameters Parameters: x (np.array): Delta pumping parameter (1) dowy (np.array(int)): Day of water year Q_in (np.array(float)): Total inflow to the Delta, cfs (sum of all reservoir outflows plus gains)...
model.py
delta_fit
jdherman/ssjrb
5
python
@njit def delta_fit(x, dowy, Q_in, Pump_pct_avg, S_total_pct, Pump_obs): '\n Evaluate Delta pumping model against historical observations for a set of parameters\n\n Parameters:\n x (np.array): Delta pumping parameter (1)\n dowy (np.array(int)): Day of water year\n Q_in (np.array(float)): Total i...
@njit def delta_fit(x, dowy, Q_in, Pump_pct_avg, S_total_pct, Pump_obs): '\n Evaluate Delta pumping model against historical observations for a set of parameters\n\n Parameters:\n x (np.array): Delta pumping parameter (1)\n dowy (np.array(int)): Day of water year\n Q_in (np.array(float)): Total i...
a276f5553f81eb75855b70072211361fcf5828661b5d7142f6a47797d09cd887
@njit def simulate(params, K, dowy, Q, Q_avg, R_avg, S_avg, Gains_avg, Pump_pct_avg, DM): '\n Run full system simulation over a given time period.\n\n Parameters:\n params (tuple(np.array)): Parameter arrays for all reservoirs, gains, and Delta\n K (np.array(float)): Reservoir capacities, acre-feet\n ...
Run full system simulation over a given time period. Parameters: params (tuple(np.array)): Parameter arrays for all reservoirs, gains, and Delta K (np.array(float)): Reservoir capacities, acre-feet dowy (np.array(int)): Day of water year Q (np.array(float, float)): Matrix of inflows at all reservoirs...
model.py
simulate
jdherman/ssjrb
5
python
@njit def simulate(params, K, dowy, Q, Q_avg, R_avg, S_avg, Gains_avg, Pump_pct_avg, DM): '\n Run full system simulation over a given time period.\n\n Parameters:\n params (tuple(np.array)): Parameter arrays for all reservoirs, gains, and Delta\n K (np.array(float)): Reservoir capacities, acre-feet\n ...
@njit def simulate(params, K, dowy, Q, Q_avg, R_avg, S_avg, Gains_avg, Pump_pct_avg, DM): '\n Run full system simulation over a given time period.\n\n Parameters:\n params (tuple(np.array)): Parameter arrays for all reservoirs, gains, and Delta\n K (np.array(float)): Reservoir capacities, acre-feet\n ...
9f6fd5e8ebcbea1acc1705a8626a451c43222564bdf98271c4444f8dcd3a6127
def __init__(self, db_engine, logger): 'Constructor\n\n :param DatabaseEngine db_engine: Database engine with DB connections\n :param Logger logger: Application logger\n ' self.db = db_engine.geo_db() self.logger = logger self.basic_info_sql = os.getenv('BASIC_INFO_SQL', self.DEFAUL...
Constructor :param DatabaseEngine db_engine: Database engine with DB connections :param Logger logger: Application logger
plot_info.py
__init__
HusseinKabbout/sogis-plotinfo-service
0
python
def __init__(self, db_engine, logger): 'Constructor\n\n :param DatabaseEngine db_engine: Database engine with DB connections\n :param Logger logger: Application logger\n ' self.db = db_engine.geo_db() self.logger = logger self.basic_info_sql = os.getenv('BASIC_INFO_SQL', self.DEFAUL...
def __init__(self, db_engine, logger): 'Constructor\n\n :param DatabaseEngine db_engine: Database engine with DB connections\n :param Logger logger: Application logger\n ' self.db = db_engine.geo_db() self.logger = logger self.basic_info_sql = os.getenv('BASIC_INFO_SQL', self.DEFAUL...