hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
50c254dc3c11ca278f4b0ac39bd8b89cf9e15b7b | bithacks-tech/myeosio | tests/Node.py | [
"MIT"
] | Python | isTransInBlock | <not_specific> | def isTransInBlock(self, transId, blockId):
"""Check if transId is within block identified by blockId"""
assert(transId)
assert(isinstance(transId, str))
assert(blockId)
assert(isinstance(blockId, int))
block=self.getBlock(blockId)
transactions=None
try:
... | Check if transId is within block identified by blockId | Check if transId is within block identified by blockId | [
"Check",
"if",
"transId",
"is",
"within",
"block",
"identified",
"by",
"blockId"
] | def isTransInBlock(self, transId, blockId):
assert(transId)
assert(isinstance(transId, str))
assert(blockId)
assert(isinstance(blockId, int))
block=self.getBlock(blockId)
transactions=None
try:
transactions=block["transactions"]
except (Asserti... | [
"def",
"isTransInBlock",
"(",
"self",
",",
"transId",
",",
"blockId",
")",
":",
"assert",
"(",
"transId",
")",
"assert",
"(",
"isinstance",
"(",
"transId",
",",
"str",
")",
")",
"assert",
"(",
"blockId",
")",
"assert",
"(",
"isinstance",
"(",
"blockId",
... | Check if transId is within block identified by blockId | [
"Check",
"if",
"transId",
"is",
"within",
"block",
"identified",
"by",
"blockId"
] | [
"\"\"\"Check if transId is within block identified by blockId\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "transId",
"type": null
},
{
"param": "blockId",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transId",
"type": null,
"docstring": null,
"docstring_tokens"... |
50c254dc3c11ca278f4b0ac39bd8b89cf9e15b7b | bithacks-tech/myeosio | tests/Node.py | [
"MIT"
] | Python | isTransInAnyBlock | <not_specific> | def isTransInAnyBlock(self, transId):
"""Check if transaction (transId) is in a block."""
assert(transId)
assert(isinstance(transId, str))
blockId=self.getBlockIdByTransId(transId)
return True if blockId else False | Check if transaction (transId) is in a block. | Check if transaction (transId) is in a block. | [
"Check",
"if",
"transaction",
"(",
"transId",
")",
"is",
"in",
"a",
"block",
"."
] | def isTransInAnyBlock(self, transId):
assert(transId)
assert(isinstance(transId, str))
blockId=self.getBlockIdByTransId(transId)
return True if blockId else False | [
"def",
"isTransInAnyBlock",
"(",
"self",
",",
"transId",
")",
":",
"assert",
"(",
"transId",
")",
"assert",
"(",
"isinstance",
"(",
"transId",
",",
"str",
")",
")",
"blockId",
"=",
"self",
".",
"getBlockIdByTransId",
"(",
"transId",
")",
"return",
"True",
... | Check if transaction (transId) is in a block. | [
"Check",
"if",
"transaction",
"(",
"transId",
")",
"is",
"in",
"a",
"block",
"."
] | [
"\"\"\"Check if transaction (transId) is in a block.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "transId",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transId",
"type": null,
"docstring": null,
"docstring_tokens"... |
50c254dc3c11ca278f4b0ac39bd8b89cf9e15b7b | bithacks-tech/myeosio | tests/Node.py | [
"MIT"
] | Python | isTransFinalized | <not_specific> | def isTransFinalized(self, transId):
"""Check if transaction (transId) has been finalized."""
assert(transId)
assert(isinstance(transId, str))
blockId=self.getBlockIdByTransId(transId)
if not blockId:
return False
assert(isinstance(blockId, int))
retu... | Check if transaction (transId) has been finalized. | Check if transaction (transId) has been finalized. | [
"Check",
"if",
"transaction",
"(",
"transId",
")",
"has",
"been",
"finalized",
"."
] | def isTransFinalized(self, transId):
assert(transId)
assert(isinstance(transId, str))
blockId=self.getBlockIdByTransId(transId)
if not blockId:
return False
assert(isinstance(blockId, int))
return self.isBlockFinalized(blockId) | [
"def",
"isTransFinalized",
"(",
"self",
",",
"transId",
")",
":",
"assert",
"(",
"transId",
")",
"assert",
"(",
"isinstance",
"(",
"transId",
",",
"str",
")",
")",
"blockId",
"=",
"self",
".",
"getBlockIdByTransId",
"(",
"transId",
")",
"if",
"not",
"blo... | Check if transaction (transId) has been finalized. | [
"Check",
"if",
"transaction",
"(",
"transId",
")",
"has",
"been",
"finalized",
"."
] | [
"\"\"\"Check if transaction (transId) has been finalized.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "transId",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transId",
"type": null,
"docstring": null,
"docstring_tokens"... |
50c254dc3c11ca278f4b0ac39bd8b89cf9e15b7b | bithacks-tech/myeosio | tests/Node.py | [
"MIT"
] | Python | waitForTransInBlock | <not_specific> | def waitForTransInBlock(self, transId, timeout=None):
"""Wait for trans id to be finalized."""
lam = lambda: self.isTransInAnyBlock(transId)
ret=Utils.waitForBool(lam, timeout)
return ret | Wait for trans id to be finalized. | Wait for trans id to be finalized. | [
"Wait",
"for",
"trans",
"id",
"to",
"be",
"finalized",
"."
] | def waitForTransInBlock(self, transId, timeout=None):
lam = lambda: self.isTransInAnyBlock(transId)
ret=Utils.waitForBool(lam, timeout)
return ret | [
"def",
"waitForTransInBlock",
"(",
"self",
",",
"transId",
",",
"timeout",
"=",
"None",
")",
":",
"lam",
"=",
"lambda",
":",
"self",
".",
"isTransInAnyBlock",
"(",
"transId",
")",
"ret",
"=",
"Utils",
".",
"waitForBool",
"(",
"lam",
",",
"timeout",
")",
... | Wait for trans id to be finalized. | [
"Wait",
"for",
"trans",
"id",
"to",
"be",
"finalized",
"."
] | [
"\"\"\"Wait for trans id to be finalized.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "transId",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transId",
"type": null,
"docstring": null,
"docstring_tokens"... |
50c254dc3c11ca278f4b0ac39bd8b89cf9e15b7b | bithacks-tech/myeosio | tests/Node.py | [
"MIT"
] | Python | waitForTransFinalization | <not_specific> | def waitForTransFinalization(self, transId, timeout=None):
"""Wait for trans id to be finalized."""
assert(isinstance(transId, str))
lam = lambda: self.isTransFinalized(transId)
ret=Utils.waitForBool(lam, timeout)
return ret | Wait for trans id to be finalized. | Wait for trans id to be finalized. | [
"Wait",
"for",
"trans",
"id",
"to",
"be",
"finalized",
"."
] | def waitForTransFinalization(self, transId, timeout=None):
assert(isinstance(transId, str))
lam = lambda: self.isTransFinalized(transId)
ret=Utils.waitForBool(lam, timeout)
return ret | [
"def",
"waitForTransFinalization",
"(",
"self",
",",
"transId",
",",
"timeout",
"=",
"None",
")",
":",
"assert",
"(",
"isinstance",
"(",
"transId",
",",
"str",
")",
")",
"lam",
"=",
"lambda",
":",
"self",
".",
"isTransFinalized",
"(",
"transId",
")",
"re... | Wait for trans id to be finalized. | [
"Wait",
"for",
"trans",
"id",
"to",
"be",
"finalized",
"."
] | [
"\"\"\"Wait for trans id to be finalized.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "transId",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "transId",
"type": null,
"docstring": null,
"docstring_tokens"... |
50c254dc3c11ca278f4b0ac39bd8b89cf9e15b7b | bithacks-tech/myeosio | tests/Node.py | [
"MIT"
] | Python | currencyStrToInt | <not_specific> | def currencyStrToInt(balanceStr):
"""Converts currency string of form "12.3456 MES" to int 123456"""
assert(isinstance(balanceStr, str))
balanceStr=balanceStr.split()[0]
#balance=int(decimal.Decimal(balanceStr[1:])*10000)
balance=int(decimal.Decimal(balanceStr)*10000)
re... | Converts currency string of form "12.3456 MES" to int 123456 | Converts currency string of form "12.3456 MES" to int 123456 | [
"Converts",
"currency",
"string",
"of",
"form",
"\"",
"12",
".",
"3456",
"MES",
"\"",
"to",
"int",
"123456"
] | def currencyStrToInt(balanceStr):
assert(isinstance(balanceStr, str))
balanceStr=balanceStr.split()[0]
balance=int(decimal.Decimal(balanceStr)*10000)
return balance | [
"def",
"currencyStrToInt",
"(",
"balanceStr",
")",
":",
"assert",
"(",
"isinstance",
"(",
"balanceStr",
",",
"str",
")",
")",
"balanceStr",
"=",
"balanceStr",
".",
"split",
"(",
")",
"[",
"0",
"]",
"balance",
"=",
"int",
"(",
"decimal",
".",
"Decimal",
... | Converts currency string of form "12.3456 MES" to int 123456 | [
"Converts",
"currency",
"string",
"of",
"form",
"\"",
"12",
".",
"3456",
"MES",
"\"",
"to",
"int",
"123456"
] | [
"\"\"\"Converts currency string of form \"12.3456 MES\" to int 123456\"\"\"",
"#balance=int(decimal.Decimal(balanceStr[1:])*10000)"
] | [
{
"param": "balanceStr",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "balanceStr",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
50c254dc3c11ca278f4b0ac39bd8b89cf9e15b7b | bithacks-tech/myeosio | tests/Node.py | [
"MIT"
] | Python | currencyIntToStr | <not_specific> | def currencyIntToStr(balance, symbol):
"""Converts currency int of form 123456 to string "12.3456 MES" where MES is symbol string"""
assert(isinstance(balance, int))
assert(isinstance(symbol, str))
balanceStr="%.04f %s" % (balance/10000.0, symbol)
return balanceStr | Converts currency int of form 123456 to string "12.3456 MES" where MES is symbol string | Converts currency int of form 123456 to string "12.3456 MES" where MES is symbol string | [
"Converts",
"currency",
"int",
"of",
"form",
"123456",
"to",
"string",
"\"",
"12",
".",
"3456",
"MES",
"\"",
"where",
"MES",
"is",
"symbol",
"string"
] | def currencyIntToStr(balance, symbol):
assert(isinstance(balance, int))
assert(isinstance(symbol, str))
balanceStr="%.04f %s" % (balance/10000.0, symbol)
return balanceStr | [
"def",
"currencyIntToStr",
"(",
"balance",
",",
"symbol",
")",
":",
"assert",
"(",
"isinstance",
"(",
"balance",
",",
"int",
")",
")",
"assert",
"(",
"isinstance",
"(",
"symbol",
",",
"str",
")",
")",
"balanceStr",
"=",
"\"%.04f %s\"",
"%",
"(",
"balance... | Converts currency int of form 123456 to string "12.3456 MES" where MES is symbol string | [
"Converts",
"currency",
"int",
"of",
"form",
"123456",
"to",
"string",
"\"",
"12",
".",
"3456",
"MES",
"\"",
"where",
"MES",
"is",
"symbol",
"string"
] | [
"\"\"\"Converts currency int of form 123456 to string \"12.3456 MES\" where MES is symbol string\"\"\""
] | [
{
"param": "balance",
"type": null
},
{
"param": "symbol",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "balance",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "symbol",
"type": null,
"docstring": null,
"docstring_token... |
50c254dc3c11ca278f4b0ac39bd8b89cf9e15b7b | bithacks-tech/myeosio | tests/Node.py | [
"MIT"
] | Python | validateFunds | <not_specific> | def validateFunds(self, initialBalances, transferAmount, source, accounts):
"""Validate each account has the expected MES balance. Validate cumulative balance matches expectedTotal."""
assert(source)
assert(isinstance(source, Account))
assert(accounts)
assert(isinstance(accounts,... | Validate each account has the expected MES balance. Validate cumulative balance matches expectedTotal. | Validate each account has the expected MES balance. Validate cumulative balance matches expectedTotal. | [
"Validate",
"each",
"account",
"has",
"the",
"expected",
"MES",
"balance",
".",
"Validate",
"cumulative",
"balance",
"matches",
"expectedTotal",
"."
] | def validateFunds(self, initialBalances, transferAmount, source, accounts):
assert(source)
assert(isinstance(source, Account))
assert(accounts)
assert(isinstance(accounts, list))
assert(len(accounts) > 0)
assert(initialBalances)
assert(isinstance(initialBalances, ... | [
"def",
"validateFunds",
"(",
"self",
",",
"initialBalances",
",",
"transferAmount",
",",
"source",
",",
"accounts",
")",
":",
"assert",
"(",
"source",
")",
"assert",
"(",
"isinstance",
"(",
"source",
",",
"Account",
")",
")",
"assert",
"(",
"accounts",
")"... | Validate each account has the expected MES balance. | [
"Validate",
"each",
"account",
"has",
"the",
"expected",
"MES",
"balance",
"."
] | [
"\"\"\"Validate each account has the expected MES balance. Validate cumulative balance matches expectedTotal.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "initialBalances",
"type": null
},
{
"param": "transferAmount",
"type": null
},
{
"param": "source",
"type": null
},
{
"param": "accounts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "initialBalances",
"type": null,
"docstring": null,
"docstring... |
50c254dc3c11ca278f4b0ac39bd8b89cf9e15b7b | bithacks-tech/myeosio | tests/Node.py | [
"MIT"
] | Python | isNodeAlive | <not_specific> | def isNodeAlive():
"""wait for node to be responsive."""
try:
return True if self.checkPulse() else False
except (TypeError) as _:
pass
return False | wait for node to be responsive. | wait for node to be responsive. | [
"wait",
"for",
"node",
"to",
"be",
"responsive",
"."
] | def isNodeAlive():
try:
return True if self.checkPulse() else False
except (TypeError) as _:
pass
return False | [
"def",
"isNodeAlive",
"(",
")",
":",
"try",
":",
"return",
"True",
"if",
"self",
".",
"checkPulse",
"(",
")",
"else",
"False",
"except",
"(",
"TypeError",
")",
"as",
"_",
":",
"pass",
"return",
"False"
] | wait for node to be responsive. | [
"wait",
"for",
"node",
"to",
"be",
"responsive",
"."
] | [
"\"\"\"wait for node to be responsive.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
b08a9c4661ab86a24874fac5bdc22e112a094529 | bithacks-tech/myeosio | tests/Cluster.py | [
"MIT"
] | Python | waitOnClusterSync | <not_specific> | def waitOnClusterSync(self, timeout=None):
"""Get head block on node 0, then ensure the block is present on every cluster node."""
assert(self.nodes)
assert(len(self.nodes) > 0)
targetHeadBlockNum=self.nodes[0].getHeadBlockNum() #get root nodes head block num
if Utils.Debug: Util... | Get head block on node 0, then ensure the block is present on every cluster node. | Get head block on node 0, then ensure the block is present on every cluster node. | [
"Get",
"head",
"block",
"on",
"node",
"0",
"then",
"ensure",
"the",
"block",
"is",
"present",
"on",
"every",
"cluster",
"node",
"."
] | def waitOnClusterSync(self, timeout=None):
assert(self.nodes)
assert(len(self.nodes) > 0)
targetHeadBlockNum=self.nodes[0].getHeadBlockNum()
if Utils.Debug: Utils.Print("Head block number on root node: %d" % (targetHeadBlockNum))
if targetHeadBlockNum == -1:
return F... | [
"def",
"waitOnClusterSync",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"assert",
"(",
"self",
".",
"nodes",
")",
"assert",
"(",
"len",
"(",
"self",
".",
"nodes",
")",
">",
"0",
")",
"targetHeadBlockNum",
"=",
"self",
".",
"nodes",
"[",
"0",
... | Get head block on node 0, then ensure the block is present on every cluster node. | [
"Get",
"head",
"block",
"on",
"node",
"0",
"then",
"ensure",
"the",
"block",
"is",
"present",
"on",
"every",
"cluster",
"node",
"."
] | [
"\"\"\"Get head block on node 0, then ensure the block is present on every cluster node.\"\"\"",
"#get root nodes head block num"
] | [
{
"param": "self",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timeout",
"type": null,
"docstring": null,
"docstring_tokens"... |
b08a9c4661ab86a24874fac5bdc22e112a094529 | bithacks-tech/myeosio | tests/Cluster.py | [
"MIT"
] | Python | waitOnClusterBlockNumSync | <not_specific> | def waitOnClusterBlockNumSync(self, targetBlockNum, timeout=None):
"""Wait for all nodes to have targetBlockNum finalized."""
assert(self.nodes)
def doNodesHaveBlockNum(nodes, targetBlockNum):
for node in nodes:
try:
if (not node.killed) and (not ... | Wait for all nodes to have targetBlockNum finalized. | Wait for all nodes to have targetBlockNum finalized. | [
"Wait",
"for",
"all",
"nodes",
"to",
"have",
"targetBlockNum",
"finalized",
"."
] | def waitOnClusterBlockNumSync(self, targetBlockNum, timeout=None):
assert(self.nodes)
def doNodesHaveBlockNum(nodes, targetBlockNum):
for node in nodes:
try:
if (not node.killed) and (not node.isBlockPresent(targetBlockNum)):
return... | [
"def",
"waitOnClusterBlockNumSync",
"(",
"self",
",",
"targetBlockNum",
",",
"timeout",
"=",
"None",
")",
":",
"assert",
"(",
"self",
".",
"nodes",
")",
"def",
"doNodesHaveBlockNum",
"(",
"nodes",
",",
"targetBlockNum",
")",
":",
"for",
"node",
"in",
"nodes"... | Wait for all nodes to have targetBlockNum finalized. | [
"Wait",
"for",
"all",
"nodes",
"to",
"have",
"targetBlockNum",
"finalized",
"."
] | [
"\"\"\"Wait for all nodes to have targetBlockNum finalized.\"\"\"",
"#if (not node.killed) and (not node.isBlockFinalized(targetBlockNum)):",
"# This can happen if client connects before server is listening"
] | [
{
"param": "self",
"type": null
},
{
"param": "targetBlockNum",
"type": null
},
{
"param": "timeout",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "targetBlockNum",
"type": null,
"docstring": null,
"docstring_... |
b08a9c4661ab86a24874fac5bdc22e112a094529 | bithacks-tech/myeosio | tests/Cluster.py | [
"MIT"
] | Python | validateSpreadFunds | <not_specific> | def validateSpreadFunds(self, initialBalances, transferAmount, source, accounts):
"""Given initial Balances, will validate each account has the expected balance based upon transferAmount.
This validation is repeated against every node in the cluster."""
assert(source)
assert(isinstance(s... | Given initial Balances, will validate each account has the expected balance based upon transferAmount.
This validation is repeated against every node in the cluster. | Given initial Balances, will validate each account has the expected balance based upon transferAmount.
This validation is repeated against every node in the cluster. | [
"Given",
"initial",
"Balances",
"will",
"validate",
"each",
"account",
"has",
"the",
"expected",
"balance",
"based",
"upon",
"transferAmount",
".",
"This",
"validation",
"is",
"repeated",
"against",
"every",
"node",
"in",
"the",
"cluster",
"."
] | def validateSpreadFunds(self, initialBalances, transferAmount, source, accounts):
assert(source)
assert(isinstance(source, Account))
assert(accounts)
assert(isinstance(accounts, list))
assert(len(accounts) > 0)
assert(initialBalances)
assert(isinstance(initialBala... | [
"def",
"validateSpreadFunds",
"(",
"self",
",",
"initialBalances",
",",
"transferAmount",
",",
"source",
",",
"accounts",
")",
":",
"assert",
"(",
"source",
")",
"assert",
"(",
"isinstance",
"(",
"source",
",",
"Account",
")",
")",
"assert",
"(",
"accounts",... | Given initial Balances, will validate each account has the expected balance based upon transferAmount. | [
"Given",
"initial",
"Balances",
"will",
"validate",
"each",
"account",
"has",
"the",
"expected",
"balance",
"based",
"upon",
"transferAmount",
"."
] | [
"\"\"\"Given initial Balances, will validate each account has the expected balance based upon transferAmount.\n This validation is repeated against every node in the cluster.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "initialBalances",
"type": null
},
{
"param": "transferAmount",
"type": null
},
{
"param": "source",
"type": null
},
{
"param": "accounts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "initialBalances",
"type": null,
"docstring": null,
"docstring... |
b08a9c4661ab86a24874fac5bdc22e112a094529 | bithacks-tech/myeosio | tests/Cluster.py | [
"MIT"
] | Python | createAccountAndVerify | <not_specific> | def createAccountAndVerify(self, account, creator, stakedDeposit=1000):
"""create account, verify account and return transaction id"""
assert(len(self.nodes) > 0)
node=self.nodes[0]
trans=node.createInitializeAccount(account, creator, stakedDeposit)
assert(trans)
assert(n... | create account, verify account and return transaction id | create account, verify account and return transaction id | [
"create",
"account",
"verify",
"account",
"and",
"return",
"transaction",
"id"
] | def createAccountAndVerify(self, account, creator, stakedDeposit=1000):
assert(len(self.nodes) > 0)
node=self.nodes[0]
trans=node.createInitializeAccount(account, creator, stakedDeposit)
assert(trans)
assert(node.verifyAccount(account))
return trans | [
"def",
"createAccountAndVerify",
"(",
"self",
",",
"account",
",",
"creator",
",",
"stakedDeposit",
"=",
"1000",
")",
":",
"assert",
"(",
"len",
"(",
"self",
".",
"nodes",
")",
">",
"0",
")",
"node",
"=",
"self",
".",
"nodes",
"[",
"0",
"]",
"trans",... | create account, verify account and return transaction id | [
"create",
"account",
"verify",
"account",
"and",
"return",
"transaction",
"id"
] | [
"\"\"\"create account, verify account and return transaction id\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "account",
"type": null
},
{
"param": "creator",
"type": null
},
{
"param": "stakedDeposit",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "account",
"type": null,
"docstring": null,
"docstring_tokens"... |
b08a9c4661ab86a24874fac5bdc22e112a094529 | bithacks-tech/myeosio | tests/Cluster.py | [
"MIT"
] | Python | parseClusterKeys | <not_specific> | def parseClusterKeys(totalNodes):
"""Parse cluster config file. Updates producer keys data members."""
node="node_bios"
configFile="etc/myeosio/%s/config.ini" % (node)
if Utils.Debug: Utils.Print("Parsing config file %s" % configFile)
producerKeys=Cluster.parseProducerKeys(confi... | Parse cluster config file. Updates producer keys data members. | Parse cluster config file. Updates producer keys data members. | [
"Parse",
"cluster",
"config",
"file",
".",
"Updates",
"producer",
"keys",
"data",
"members",
"."
] | def parseClusterKeys(totalNodes):
node="node_bios"
configFile="etc/myeosio/%s/config.ini" % (node)
if Utils.Debug: Utils.Print("Parsing config file %s" % configFile)
producerKeys=Cluster.parseProducerKeys(configFile, node)
if producerKeys is None:
Utils.Print("ERROR: ... | [
"def",
"parseClusterKeys",
"(",
"totalNodes",
")",
":",
"node",
"=",
"\"node_bios\"",
"configFile",
"=",
"\"etc/myeosio/%s/config.ini\"",
"%",
"(",
"node",
")",
"if",
"Utils",
".",
"Debug",
":",
"Utils",
".",
"Print",
"(",
"\"Parsing config file %s\"",
"%",
"con... | Parse cluster config file. | [
"Parse",
"cluster",
"config",
"file",
"."
] | [
"\"\"\"Parse cluster config file. Updates producer keys data members.\"\"\""
] | [
{
"param": "totalNodes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "totalNodes",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b08a9c4661ab86a24874fac5bdc22e112a094529 | bithacks-tech/myeosio | tests/Cluster.py | [
"MIT"
] | Python | killall | null | def killall(self, silent=True, allInstances=False):
"""Kill cluster myeosnode instances. allInstances will kill all myeosnode instances running on the system."""
cmd="%s -k 9" % (Utils.EnuLauncherPath)
if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
if 0 != subprocess.call(cmd.split(), st... | Kill cluster myeosnode instances. allInstances will kill all myeosnode instances running on the system. | Kill cluster myeosnode instances. allInstances will kill all myeosnode instances running on the system. | [
"Kill",
"cluster",
"myeosnode",
"instances",
".",
"allInstances",
"will",
"kill",
"all",
"myeosnode",
"instances",
"running",
"on",
"the",
"system",
"."
] | def killall(self, silent=True, allInstances=False):
cmd="%s -k 9" % (Utils.EnuLauncherPath)
if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
if 0 != subprocess.call(cmd.split(), stdout=Utils.FNull):
if not silent: Utils.Print("Launcher failed to shut down myeos cluster.")
if al... | [
"def",
"killall",
"(",
"self",
",",
"silent",
"=",
"True",
",",
"allInstances",
"=",
"False",
")",
":",
"cmd",
"=",
"\"%s -k 9\"",
"%",
"(",
"Utils",
".",
"EnuLauncherPath",
")",
"if",
"Utils",
".",
"Debug",
":",
"Utils",
".",
"Print",
"(",
"\"cmd: %s\... | Kill cluster myeosnode instances. | [
"Kill",
"cluster",
"myeosnode",
"instances",
"."
] | [
"\"\"\"Kill cluster myeosnode instances. allInstances will kill all myeosnode instances running on the system.\"\"\"",
"# ocassionally the launcher cannot kill the myeos server",
"# another explicit nodes shutdown"
] | [
{
"param": "self",
"type": null
},
{
"param": "silent",
"type": null
},
{
"param": "allInstances",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "silent",
"type": null,
"docstring": null,
"docstring_tokens":... |
69ba86e024ffdb77ab091b22f04b4e93fe1296e1 | hivemined/queen | src/hivemined/container.py | [
"Apache-2.0"
] | Python | exists | <not_specific> | def exists(self, running=False):
"""Return True if the container referenced by this object exists, or False otherwise.
If running==True, check if the container is running instead.
"""
if not self.container.get('Id'):
return False
containers = self.list(show_all=(not ... | Return True if the container referenced by this object exists, or False otherwise.
If running==True, check if the container is running instead.
| Return True if the container referenced by this object exists, or False otherwise.
If running==True, check if the container is running instead. | [
"Return",
"True",
"if",
"the",
"container",
"referenced",
"by",
"this",
"object",
"exists",
"or",
"False",
"otherwise",
".",
"If",
"running",
"==",
"True",
"check",
"if",
"the",
"container",
"is",
"running",
"instead",
"."
] | def exists(self, running=False):
if not self.container.get('Id'):
return False
containers = self.list(show_all=(not running))
return next((True for c in containers if c.get('Id') == self.container.get('Id')), False) | [
"def",
"exists",
"(",
"self",
",",
"running",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"container",
".",
"get",
"(",
"'Id'",
")",
":",
"return",
"False",
"containers",
"=",
"self",
".",
"list",
"(",
"show_all",
"=",
"(",
"not",
"running",
... | Return True if the container referenced by this object exists, or False otherwise. | [
"Return",
"True",
"if",
"the",
"container",
"referenced",
"by",
"this",
"object",
"exists",
"or",
"False",
"otherwise",
"."
] | [
"\"\"\"Return True if the container referenced by this object exists, or False otherwise.\n\n If running==True, check if the container is running instead.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "running",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "running",
"type": null,
"docstring": null,
"docstring_tokens"... |
69ba86e024ffdb77ab091b22f04b4e93fe1296e1 | hivemined/queen | src/hivemined/container.py | [
"Apache-2.0"
] | Python | create | <not_specific> | def create(self, force=False, **kwargs):
"""Create a new managed docker container.
If force==True, create new a container even if one already exists.
Propagates LookupError from self.image.get() f the image does not exist and cannot be pulled or built,
Raises Warning if container creati... | Create a new managed docker container.
If force==True, create new a container even if one already exists.
Propagates LookupError from self.image.get() f the image does not exist and cannot be pulled or built,
Raises Warning if container creation resulted in warnings form Docker.
| Create a new managed docker container.
If force==True, create new a container even if one already exists.
Propagates LookupError from self.image.get() f the image does not exist and cannot be pulled or built,
Raises Warning if container creation resulted in warnings form Docker. | [
"Create",
"a",
"new",
"managed",
"docker",
"container",
".",
"If",
"force",
"==",
"True",
"create",
"new",
"a",
"container",
"even",
"if",
"one",
"already",
"exists",
".",
"Propagates",
"LookupError",
"from",
"self",
".",
"image",
".",
"get",
"()",
"f",
... | def create(self, force=False, **kwargs):
labels = {type(self).label: None, 'name': self.name}
if self.exists() and not force:
return
try:
self.image.get()
except LookupError as e:
print(e)
raise
volume_list = []
for v in... | [
"def",
"create",
"(",
"self",
",",
"force",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"labels",
"=",
"{",
"type",
"(",
"self",
")",
".",
"label",
":",
"None",
",",
"'name'",
":",
"self",
".",
"name",
"}",
"if",
"self",
".",
"exists",
"(",
")... | Create a new managed docker container. | [
"Create",
"a",
"new",
"managed",
"docker",
"container",
"."
] | [
"\"\"\"Create a new managed docker container.\n\n If force==True, create new a container even if one already exists.\n Propagates LookupError from self.image.get() f the image does not exist and cannot be pulled or built,\n Raises Warning if container creation resulted in warnings form Docker.\... | [
{
"param": "self",
"type": null
},
{
"param": "force",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "force",
"type": null,
"docstring": null,
"docstring_tokens": ... |
1f56f454b3f900187a4e0cc891e81a05be2c7ba3 | hivemined/queen | src/hivemined/worker.py | [
"Apache-2.0"
] | Python | command | null | def command(self, command, tty=False):
"""Send a command to the Minecraft server.
:param command: The command to send
"""
exec_str = 'cmd ' + str(command)
super().command(exec_str) | Send a command to the Minecraft server.
:param command: The command to send
| Send a command to the Minecraft server. | [
"Send",
"a",
"command",
"to",
"the",
"Minecraft",
"server",
"."
] | def command(self, command, tty=False):
exec_str = 'cmd ' + str(command)
super().command(exec_str) | [
"def",
"command",
"(",
"self",
",",
"command",
",",
"tty",
"=",
"False",
")",
":",
"exec_str",
"=",
"'cmd '",
"+",
"str",
"(",
"command",
")",
"super",
"(",
")",
".",
"command",
"(",
"exec_str",
")"
] | Send a command to the Minecraft server. | [
"Send",
"a",
"command",
"to",
"the",
"Minecraft",
"server",
"."
] | [
"\"\"\"Send a command to the Minecraft server.\n\n :param command: The command to send\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "command",
"type": null
},
{
"param": "tty",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "command",
"type": null,
"docstring": "The command to send",
"... |
e1eb4a0d1cf6a8d10d08e282701e938ed72c034c | hivemined/queen | src/hivemined/comb.py | [
"Apache-2.0"
] | Python | validate | <not_specific> | def validate(image):
"""Verify that image is a valid base image for COmb.
:param image: The image to validate
"""
image_data = Docker.inspect_image(image)
# Checks on image data
if image_data:
return True
else:
return False | Verify that image is a valid base image for COmb.
:param image: The image to validate
| Verify that image is a valid base image for COmb. | [
"Verify",
"that",
"image",
"is",
"a",
"valid",
"base",
"image",
"for",
"COmb",
"."
] | def validate(image):
image_data = Docker.inspect_image(image)
if image_data:
return True
else:
return False | [
"def",
"validate",
"(",
"image",
")",
":",
"image_data",
"=",
"Docker",
".",
"inspect_image",
"(",
"image",
")",
"if",
"image_data",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | Verify that image is a valid base image for COmb. | [
"Verify",
"that",
"image",
"is",
"a",
"valid",
"base",
"image",
"for",
"COmb",
"."
] | [
"\"\"\"Verify that image is a valid base image for COmb.\n\n :param image: The image to validate\n \"\"\"",
"# Checks on image data"
] | [
{
"param": "image",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "image",
"type": null,
"docstring": "The image to validate",
"docstring_tokens": [
"The",
"image",
"to",
"validate"
],
"default": null,
"is_optional": null
}
],
"outlier... |
66e9e4c3d0155ce2f4eb7cbdf4c84e23da17d951 | hivemined/queen | src/hivemined/image.py | [
"Apache-2.0"
] | Python | list | <not_specific> | def list(self, quiet=False):
"""List all images under the repository.
:param quiet: Whether to output a list of dicts or strings.
"""
return Docker.images(name=self.name, quiet=quiet) | List all images under the repository.
:param quiet: Whether to output a list of dicts or strings.
| List all images under the repository. | [
"List",
"all",
"images",
"under",
"the",
"repository",
"."
] | def list(self, quiet=False):
return Docker.images(name=self.name, quiet=quiet) | [
"def",
"list",
"(",
"self",
",",
"quiet",
"=",
"False",
")",
":",
"return",
"Docker",
".",
"images",
"(",
"name",
"=",
"self",
".",
"name",
",",
"quiet",
"=",
"quiet",
")"
] | List all images under the repository. | [
"List",
"all",
"images",
"under",
"the",
"repository",
"."
] | [
"\"\"\"List all images under the repository.\n\n :param quiet: Whether to output a list of dicts or strings.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "quiet",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "quiet",
"type": null,
"docstring": "Whether to output a list of dic... |
66e9e4c3d0155ce2f4eb7cbdf4c84e23da17d951 | hivemined/queen | src/hivemined/image.py | [
"Apache-2.0"
] | Python | exists | <not_specific> | def exists(self):
"""Return True if the image referenced by this object exists, False otherwise."""
if not self.name:
return False
images = self.list()
if images:
if not self.tag:
return True
else:
for i in images:
... | Return True if the image referenced by this object exists, False otherwise. | Return True if the image referenced by this object exists, False otherwise. | [
"Return",
"True",
"if",
"the",
"image",
"referenced",
"by",
"this",
"object",
"exists",
"False",
"otherwise",
"."
] | def exists(self):
if not self.name:
return False
images = self.list()
if images:
if not self.tag:
return True
else:
for i in images:
if next((True for t in i.get('RepoTags') if t == self.tag), False):
... | [
"def",
"exists",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"name",
":",
"return",
"False",
"images",
"=",
"self",
".",
"list",
"(",
")",
"if",
"images",
":",
"if",
"not",
"self",
".",
"tag",
":",
"return",
"True",
"else",
":",
"for",
"i",
... | Return True if the image referenced by this object exists, False otherwise. | [
"Return",
"True",
"if",
"the",
"image",
"referenced",
"by",
"this",
"object",
"exists",
"False",
"otherwise",
"."
] | [
"\"\"\"Return True if the image referenced by this object exists, False otherwise.\"\"\"",
"# next((True for i in images[0].get('RepoTags') if i == self.tag), False)"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
326869ebc540ae3f2c7102d80b04127a95aeda8a | kirnap/algorithms-in-python | count_number_of_inversions.py | [
"MIT"
] | Python | find_inversions | <not_specific> | def find_inversions(iterable):
"""
Since sort_and_count function returns a tuple and I just need the number of inversions first part is enough for
me
List:parameter
Number:return
"""
return sort_and_count(iterable)[1] |
Since sort_and_count function returns a tuple and I just need the number of inversions first part is enough for
me
List:parameter
Number:return
| Since sort_and_count function returns a tuple and I just need the number of inversions first part is enough for
me
List:parameter
Number:return | [
"Since",
"sort_and_count",
"function",
"returns",
"a",
"tuple",
"and",
"I",
"just",
"need",
"the",
"number",
"of",
"inversions",
"first",
"part",
"is",
"enough",
"for",
"me",
"List",
":",
"parameter",
"Number",
":",
"return"
] | def find_inversions(iterable):
return sort_and_count(iterable)[1] | [
"def",
"find_inversions",
"(",
"iterable",
")",
":",
"return",
"sort_and_count",
"(",
"iterable",
")",
"[",
"1",
"]"
] | Since sort_and_count function returns a tuple and I just need the number of inversions first part is enough for
me
List:parameter
Number:return | [
"Since",
"sort_and_count",
"function",
"returns",
"a",
"tuple",
"and",
"I",
"just",
"need",
"the",
"number",
"of",
"inversions",
"first",
"part",
"is",
"enough",
"for",
"me",
"List",
":",
"parameter",
"Number",
":",
"return"
] | [
"\"\"\"\n Since sort_and_count function returns a tuple and I just need the number of inversions first part is enough for\n me\n List:parameter\n Number:return\n \"\"\""
] | [
{
"param": "iterable",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "iterable",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
326869ebc540ae3f2c7102d80b04127a95aeda8a | kirnap/algorithms-in-python | count_number_of_inversions.py | [
"MIT"
] | Python | merge_and_count | <not_specific> | def merge_and_count(first, second):
"""
It is explained during lecture that while implementing merge part there is a single path that
counts the inversions automatically if the second part of the
"""
i = 0
j = 0
ret = []
number_of_inversion = 0
while len(ret) != len(first) + len(sec... |
It is explained during lecture that while implementing merge part there is a single path that
counts the inversions automatically if the second part of the
| It is explained during lecture that while implementing merge part there is a single path that
counts the inversions automatically if the second part of the | [
"It",
"is",
"explained",
"during",
"lecture",
"that",
"while",
"implementing",
"merge",
"part",
"there",
"is",
"a",
"single",
"path",
"that",
"counts",
"the",
"inversions",
"automatically",
"if",
"the",
"second",
"part",
"of",
"the"
] | def merge_and_count(first, second):
i = 0
j = 0
ret = []
number_of_inversion = 0
while len(ret) != len(first) + len(second):
if i == len(first):
ret += second[j:]
elif j == len(second):
ret += first[i:]
else:
if first[i] < second[j]:
... | [
"def",
"merge_and_count",
"(",
"first",
",",
"second",
")",
":",
"i",
"=",
"0",
"j",
"=",
"0",
"ret",
"=",
"[",
"]",
"number_of_inversion",
"=",
"0",
"while",
"len",
"(",
"ret",
")",
"!=",
"len",
"(",
"first",
")",
"+",
"len",
"(",
"second",
")",... | It is explained during lecture that while implementing merge part there is a single path that
counts the inversions automatically if the second part of the | [
"It",
"is",
"explained",
"during",
"lecture",
"that",
"while",
"implementing",
"merge",
"part",
"there",
"is",
"a",
"single",
"path",
"that",
"counts",
"the",
"inversions",
"automatically",
"if",
"the",
"second",
"part",
"of",
"the"
] | [
"\"\"\"\n It is explained during lecture that while implementing merge part there is a single path that\n counts the inversions automatically if the second part of the\n\n \"\"\""
] | [
{
"param": "first",
"type": null
},
{
"param": "second",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "first",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "second",
"type": null,
"docstring": null,
"docstring_tokens"... |
8a617ecbb811ff1013bf3d0aa78f6d8d3d26798e | AiPEX-Lab/rppg_biases | blandaltman.py | [
"MIT"
] | Python | detrendFun | <not_specific> | def detrendFun(method, data1, data2):
"""
Model and remove a mutiplicative offset between data1 and data2 by method
:param method: Detrending method to use
:type method: None or str
:param numpy.array data1: Array of first measures
:param numpy.array data2: Array of second measures
"""
slope = slop... |
Model and remove a mutiplicative offset between data1 and data2 by method
:param method: Detrending method to use
:type method: None or str
:param numpy.array data1: Array of first measures
:param numpy.array data2: Array of second measures
| Model and remove a mutiplicative offset between data1 and data2 by method | [
"Model",
"and",
"remove",
"a",
"mutiplicative",
"offset",
"between",
"data1",
"and",
"data2",
"by",
"method"
] | def detrendFun(method, data1, data2):
slope = slopeErr = None
if method is None:
pass
elif method.lower() == 'linear':
reg = stats.linregress(data1, data2)
slope = reg.slope
slopeErr = reg.stderr
data2 = data2 / slope
elif method.lower() == 'odr':
from scipy import odr
def f(B, x):
return B[0]*x + ... | [
"def",
"detrendFun",
"(",
"method",
",",
"data1",
",",
"data2",
")",
":",
"slope",
"=",
"slopeErr",
"=",
"None",
"if",
"method",
"is",
"None",
":",
"pass",
"elif",
"method",
".",
"lower",
"(",
")",
"==",
"'linear'",
":",
"reg",
"=",
"stats",
".",
"... | Model and remove a mutiplicative offset between data1 and data2 by method | [
"Model",
"and",
"remove",
"a",
"mutiplicative",
"offset",
"between",
"data1",
"and",
"data2",
"by",
"method"
] | [
"\"\"\"\r\n\tModel and remove a mutiplicative offset between data1 and data2 by method\r\n\r\n\t:param method: Detrending method to use \r\n\t:type method: None or str\r\n\t:param numpy.array data1: Array of first measures\r\n\t:param numpy.array data2: Array of second measures\r\n\t\"\"\""
] | [
{
"param": "method",
"type": null
},
{
"param": "data1",
"type": null
},
{
"param": "data2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "method",
"type": null,
"docstring": "Detrending method to use",
"docstring_tokens": [
"Detrending",
"method",
"to",
"use"
],
"default": null,
"is_optional": null
},
{
... |
8a617ecbb811ff1013bf3d0aa78f6d8d3d26798e | AiPEX-Lab/rppg_biases | blandaltman.py | [
"MIT"
] | Python | calculateConfidenceIntervals | <not_specific> | def calculateConfidenceIntervals(md, sd, n, limitOfAgreement, confidenceInterval, confidenceIntervalMethod):
"""
Calculate confidence intervals on the mean difference and limits of agreement.
Two methods are supported, the approximate method descibed by Bland & Altman, and the exact paired method described by C... |
Calculate confidence intervals on the mean difference and limits of agreement.
Two methods are supported, the approximate method descibed by Bland & Altman, and the exact paired method described by Carket.
:param float md:
:param float sd:
:param int n: Number of paired observations
:param float limitO... | Calculate confidence intervals on the mean difference and limits of agreement.
Two methods are supported, the approximate method descibed by Bland & Altman, and the exact paired method described by Carket. | [
"Calculate",
"confidence",
"intervals",
"on",
"the",
"mean",
"difference",
"and",
"limits",
"of",
"agreement",
".",
"Two",
"methods",
"are",
"supported",
"the",
"approximate",
"method",
"descibed",
"by",
"Bland",
"&",
"Altman",
"and",
"the",
"exact",
"paired",
... | def calculateConfidenceIntervals(md, sd, n, limitOfAgreement, confidenceInterval, confidenceIntervalMethod):
confidenceIntervals = dict()
if not (confidenceInterval < 99.9) & (confidenceInterval > 1):
raise ValueError(f'"confidenceInterval" must be a number in the range 1 to 99, "{confidenceInterval}" provided.')
... | [
"def",
"calculateConfidenceIntervals",
"(",
"md",
",",
"sd",
",",
"n",
",",
"limitOfAgreement",
",",
"confidenceInterval",
",",
"confidenceIntervalMethod",
")",
":",
"confidenceIntervals",
"=",
"dict",
"(",
")",
"if",
"not",
"(",
"confidenceInterval",
"<",
"99.9",... | Calculate confidence intervals on the mean difference and limits of agreement. | [
"Calculate",
"confidence",
"intervals",
"on",
"the",
"mean",
"difference",
"and",
"limits",
"of",
"agreement",
"."
] | [
"\"\"\"\r\n\tCalculate confidence intervals on the mean difference and limits of agreement.\r\n\r\n\tTwo methods are supported, the approximate method descibed by Bland & Altman, and the exact paired method described by Carket.\r\n\r\n\t:param float md:\r\n\t:param float sd:\r\n\t:param int n: Number of paired obse... | [
{
"param": "md",
"type": null
},
{
"param": "sd",
"type": null
},
{
"param": "n",
"type": null
},
{
"param": "limitOfAgreement",
"type": null
},
{
"param": "confidenceInterval",
"type": null
},
{
"param": "confidenceIntervalMethod",
"type": null
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "md",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": false
},
{
"identifier": "sd",
"type": null,
"docstring": null,
"d... |
8a617ecbb811ff1013bf3d0aa78f6d8d3d26798e | AiPEX-Lab/rppg_biases | blandaltman.py | [
"MIT"
] | Python | _drawBlandAltman | <not_specific> | def _drawBlandAltman(mean, diff, md, sd, percentage, limitOfAgreement, confidenceIntervals, detrend, title, ax, figureSize, dpi, savePath, figureFormat, meanColour, loaColour, pointColour):
"""
Sub function to draw the plot.
"""
if ax is None:
fig, ax = plt.subplots(1,1, figsize=figureSize, dpi=dpi)
plt.r... |
Sub function to draw the plot.
| Sub function to draw the plot. | [
"Sub",
"function",
"to",
"draw",
"the",
"plot",
"."
] | def _drawBlandAltman(mean, diff, md, sd, percentage, limitOfAgreement, confidenceIntervals, detrend, title, ax, figureSize, dpi, savePath, figureFormat, meanColour, loaColour, pointColour):
if ax is None:
fig, ax = plt.subplots(1,1, figsize=figureSize, dpi=dpi)
plt.rcParams.update({'font.size': 15,'xtick.labelsize... | [
"def",
"_drawBlandAltman",
"(",
"mean",
",",
"diff",
",",
"md",
",",
"sd",
",",
"percentage",
",",
"limitOfAgreement",
",",
"confidenceIntervals",
",",
"detrend",
",",
"title",
",",
"ax",
",",
"figureSize",
",",
"dpi",
",",
"savePath",
",",
"figureFormat",
... | Sub function to draw the plot. | [
"Sub",
"function",
"to",
"draw",
"the",
"plot",
"."
] | [
"\"\"\"\r\n\tSub function to draw the plot.\r\n\t\"\"\"",
"# ax.rcParams.update({'font.size': 15})\r",
"# ax=ax[0,0]\r",
"##\r",
"# Plot CIs if calculated\r",
"##\r",
"##\r",
"# Plot the mean diff and LoA\r",
"##\r",
"##\r",
"# Plot the data points\r",
"##\r",
"# ax.scatter(mean[0:22], diff[... | [
{
"param": "mean",
"type": null
},
{
"param": "diff",
"type": null
},
{
"param": "md",
"type": null
},
{
"param": "sd",
"type": null
},
{
"param": "percentage",
"type": null
},
{
"param": "limitOfAgreement",
"type": null
},
{
"param": "conf... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mean",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "diff",
"type": null,
"docstring": null,
"docstring_tokens": [... |
69d18497ab5af3b8f399e72ae229c22d319000cb | zvelo/pattern | pattern/text/es/inflect.py | [
"BSD-3-Clause"
] | Python | find_lemma | <not_specific> | def find_lemma(self, verb):
""" Returns the base form of the given inflected verb, using a rule-based approach.
"""
# Spanish has 12,000+ verbs, ending in -ar (85%), -er (8%), -ir (7%).
# Over 65% of -ar verbs (6500+) have a regular inflection.
v = verb.lower()
# Probably... | Returns the base form of the given inflected verb, using a rule-based approach.
| Returns the base form of the given inflected verb, using a rule-based approach. | [
"Returns",
"the",
"base",
"form",
"of",
"the",
"given",
"inflected",
"verb",
"using",
"a",
"rule",
"-",
"based",
"approach",
"."
] | def find_lemma(self, verb):
v = verb.lower()
er_ir = lambda b: (len(b) > 2 and b[-2] == "i") and b+"ir" or b+"er"
if v.endswith(("ar", "er", "ir")):
return v
for a, b in verb_irregular_inflections:
if v.endswith(a):
return v[:-len(a)] + b
v... | [
"def",
"find_lemma",
"(",
"self",
",",
"verb",
")",
":",
"v",
"=",
"verb",
".",
"lower",
"(",
")",
"er_ir",
"=",
"lambda",
"b",
":",
"(",
"len",
"(",
"b",
")",
">",
"2",
"and",
"b",
"[",
"-",
"2",
"]",
"==",
"\"i\"",
")",
"and",
"b",
"+",
... | Returns the base form of the given inflected verb, using a rule-based approach. | [
"Returns",
"the",
"base",
"form",
"of",
"the",
"given",
"inflected",
"verb",
"using",
"a",
"rule",
"-",
"based",
"approach",
"."
] | [
"\"\"\" Returns the base form of the given inflected verb, using a rule-based approach.\n \"\"\"",
"# Spanish has 12,000+ verbs, ending in -ar (85%), -er (8%), -ir (7%).",
"# Over 65% of -ar verbs (6500+) have a regular inflection.",
"# Probably ends in -ir if preceding vowel in stem is -i.",
"# Prob... | [
{
"param": "self",
"type": null
},
{
"param": "verb",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "verb",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ecd2f73a19d977d5886a9cccc023937cebaa72d7 | zvelo/pattern | examples/06-graph/03-template.py | [
"BSD-3-Clause"
] | Python | webpage | <not_specific> | def webpage(graph, head="", style="", body=("",""), **kwargs):
""" The head, style and body parameters can be used to insert custom HTML in the template.
You can pass any optional parameter that can also be passed to render().
"""
s1 = render(graph, type=STYLE, **kwargs)
s2 = render(graph, type... | The head, style and body parameters can be used to insert custom HTML in the template.
You can pass any optional parameter that can also be passed to render().
| The head, style and body parameters can be used to insert custom HTML in the template.
You can pass any optional parameter that can also be passed to render(). | [
"The",
"head",
"style",
"and",
"body",
"parameters",
"can",
"be",
"used",
"to",
"insert",
"custom",
"HTML",
"in",
"the",
"template",
".",
"You",
"can",
"pass",
"any",
"optional",
"parameter",
"that",
"can",
"also",
"be",
"passed",
"to",
"render",
"()",
"... | def webpage(graph, head="", style="", body=("",""), **kwargs):
s1 = render(graph, type=STYLE, **kwargs)
s2 = render(graph, type=CANVAS, **kwargs)
f1 = lambda s, t="\t": s.replace("\n","\n"+t)
f2 = lambda s, t="\t": ("\n%s%s" % (t,s.lstrip())).rstrip()
return template % (
f2(head), f1(s1), f... | [
"def",
"webpage",
"(",
"graph",
",",
"head",
"=",
"\"\"",
",",
"style",
"=",
"\"\"",
",",
"body",
"=",
"(",
"\"\"",
",",
"\"\"",
")",
",",
"**",
"kwargs",
")",
":",
"s1",
"=",
"render",
"(",
"graph",
",",
"type",
"=",
"STYLE",
",",
"**",
"kwarg... | The head, style and body parameters can be used to insert custom HTML in the template. | [
"The",
"head",
"style",
"and",
"body",
"parameters",
"can",
"be",
"used",
"to",
"insert",
"custom",
"HTML",
"in",
"the",
"template",
"."
] | [
"\"\"\" The head, style and body parameters can be used to insert custom HTML in the template.\n You can pass any optional parameter that can also be passed to render().\n \"\"\"",
"# Fix HTML source indentation:",
"# f1 = indent each line",
"# f2 = indent first line"
] | [
{
"param": "graph",
"type": null
},
{
"param": "head",
"type": null
},
{
"param": "style",
"type": null
},
{
"param": "body",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "graph",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "head",
"type": null,
"docstring": null,
"docstring_tokens": ... |
16e317bbe49a34b4587e4c8f7ab76fb1511cc4a0 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | protocol_descriptors.py | [
"MIT"
] | Python | parse_data_one | <not_specific> | def parse_data_one(data, int_format=True):
''' Parse data to int array and return it. '''
data_array = []
for byte_idx, byte in enumerate(data):
if int_format:
data_array.append(int(byte))
else:
data_array.append(byte)
return data_array | Parse data to int array and return it. | Parse data to int array and return it. | [
"Parse",
"data",
"to",
"int",
"array",
"and",
"return",
"it",
"."
] | def parse_data_one(data, int_format=True):
data_array = []
for byte_idx, byte in enumerate(data):
if int_format:
data_array.append(int(byte))
else:
data_array.append(byte)
return data_array | [
"def",
"parse_data_one",
"(",
"data",
",",
"int_format",
"=",
"True",
")",
":",
"data_array",
"=",
"[",
"]",
"for",
"byte_idx",
",",
"byte",
"in",
"enumerate",
"(",
"data",
")",
":",
"if",
"int_format",
":",
"data_array",
".",
"append",
"(",
"int",
"("... | Parse data to int array and return it. | [
"Parse",
"data",
"to",
"int",
"array",
"and",
"return",
"it",
"."
] | [
"''' Parse data to int array and return it. '''"
] | [
{
"param": "data",
"type": null
},
{
"param": "int_format",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "int_format",
"type": null,
"docstring": null,
"docstring_toke... |
16e317bbe49a34b4587e4c8f7ab76fb1511cc4a0 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | protocol_descriptors.py | [
"MIT"
] | Python | append_crc_to_message | <not_specific> | def append_crc_to_message(message):
''' This function takes message as argument and append a
crc value at the designated spot at the end.
Crc is calculated from the whole message up to the
mentioned designated spot for crc '''
crc_value = get_crc(bytes(message[:-BODY_END_CRC_LENGTH... | This function takes message as argument and append a
crc value at the designated spot at the end.
Crc is calculated from the whole message up to the
mentioned designated spot for crc | This function takes message as argument and append a
crc value at the designated spot at the end.
Crc is calculated from the whole message up to the
mentioned designated spot for crc | [
"This",
"function",
"takes",
"message",
"as",
"argument",
"and",
"append",
"a",
"crc",
"value",
"at",
"the",
"designated",
"spot",
"at",
"the",
"end",
".",
"Crc",
"is",
"calculated",
"from",
"the",
"whole",
"message",
"up",
"to",
"the",
"mentioned",
"desig... | def append_crc_to_message(message):
crc_value = get_crc(bytes(message[:-BODY_END_CRC_LENGTH]))
print(f"message len at the beginning: {len(message)}")
crc_byte_value = crc_value.to_bytes(BODY_END_CRC_LENGTH,'big')
start_idx_crc = len(message) - BODY_END_CRC_LENGTH
for crc_byte_idx in range(BODY_END_C... | [
"def",
"append_crc_to_message",
"(",
"message",
")",
":",
"crc_value",
"=",
"get_crc",
"(",
"bytes",
"(",
"message",
"[",
":",
"-",
"BODY_END_CRC_LENGTH",
"]",
")",
")",
"print",
"(",
"f\"message len at the beginning: {len(message)}\"",
")",
"crc_byte_value",
"=",
... | This function takes message as argument and append a
crc value at the designated spot at the end. | [
"This",
"function",
"takes",
"message",
"as",
"argument",
"and",
"append",
"a",
"crc",
"value",
"at",
"the",
"designated",
"spot",
"at",
"the",
"end",
"."
] | [
"''' This function takes message as argument and append a \r\n crc value at the designated spot at the end.\r\n Crc is calculated from the whole message up to the\r\n mentioned designated spot for crc '''",
"# write filename\r"
] | [
{
"param": "message",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "message",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
16e317bbe49a34b4587e4c8f7ab76fb1511cc4a0 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | protocol_descriptors.py | [
"MIT"
] | Python | check_crc_received_message | <not_specific> | def check_crc_received_message(message):
''' This function takes as an argument whole received message
with included crc. Calculated crc from stripped message (without crc)
and compares it to the crc in the message. '''
# Crc value from stripped message
crc_value = get_crc(bytes(message[:-BODY_... | This function takes as an argument whole received message
with included crc. Calculated crc from stripped message (without crc)
and compares it to the crc in the message. | This function takes as an argument whole received message
with included crc. Calculated crc from stripped message (without crc)
and compares it to the crc in the message. | [
"This",
"function",
"takes",
"as",
"an",
"argument",
"whole",
"received",
"message",
"with",
"included",
"crc",
".",
"Calculated",
"crc",
"from",
"stripped",
"message",
"(",
"without",
"crc",
")",
"and",
"compares",
"it",
"to",
"the",
"crc",
"in",
"the",
"... | def check_crc_received_message(message):
crc_value = get_crc(bytes(message[:-BODY_END_CRC_LENGTH]))
crc_byte_value = crc_value.to_bytes(BODY_END_CRC_LENGTH,'big')
crc_start_idx = len(message) - BODY_END_CRC_LENGTH
crc_body_body_byte_value = message[crc_start_idx:]
if isinstance(crc_body_body_byte_... | [
"def",
"check_crc_received_message",
"(",
"message",
")",
":",
"crc_value",
"=",
"get_crc",
"(",
"bytes",
"(",
"message",
"[",
":",
"-",
"BODY_END_CRC_LENGTH",
"]",
")",
")",
"crc_byte_value",
"=",
"crc_value",
".",
"to_bytes",
"(",
"BODY_END_CRC_LENGTH",
",",
... | This function takes as an argument whole received message
with included crc. | [
"This",
"function",
"takes",
"as",
"an",
"argument",
"whole",
"received",
"message",
"with",
"included",
"crc",
"."
] | [
"''' This function takes as an argument whole received message\r\n with included crc. Calculated crc from stripped message (without crc)\r\n and compares it to the crc in the message. '''",
"# Crc value from stripped message\r",
"# Read crc byte data from message\r",
"#\r",
"# print(f\"crc_body_body_b... | [
{
"param": "message",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "message",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
04060900fff1e0bbe7216166f9322ae1a210b9f3 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_sender.py | [
"MIT"
] | Python | parse_data | <not_specific> | def parse_data(self, data):
''' Parse data to int array and return header and body. '''
data_array = []
for byte_idx, byte in enumerate(data):
data_array.append(int(byte))
header = data_array[0:HEADER_SIZE]
body = data_array[HEADER_SIZE:]
return hea... | Parse data to int array and return header and body. | Parse data to int array and return header and body. | [
"Parse",
"data",
"to",
"int",
"array",
"and",
"return",
"header",
"and",
"body",
"."
] | def parse_data(self, data):
data_array = []
for byte_idx, byte in enumerate(data):
data_array.append(int(byte))
header = data_array[0:HEADER_SIZE]
body = data_array[HEADER_SIZE:]
return header, body | [
"def",
"parse_data",
"(",
"self",
",",
"data",
")",
":",
"data_array",
"=",
"[",
"]",
"for",
"byte_idx",
",",
"byte",
"in",
"enumerate",
"(",
"data",
")",
":",
"data_array",
".",
"append",
"(",
"int",
"(",
"byte",
")",
")",
"header",
"=",
"data_array... | Parse data to int array and return header and body. | [
"Parse",
"data",
"to",
"int",
"array",
"and",
"return",
"header",
"and",
"body",
"."
] | [
"''' Parse data to int array and return header and body. '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
04060900fff1e0bbe7216166f9322ae1a210b9f3 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_sender.py | [
"MIT"
] | Python | parse_file_request | <not_specific> | def parse_file_request(self, data):
''' Parse received file request message from receiver application
to body and header -> extract file name and return it. '''
header, body = self.parse_data(data)
ret_dict = {}
# NET DERPER CHANGES FIRST NUM TO CHAR
if not ... | Parse received file request message from receiver application
to body and header -> extract file name and return it. | Parse received file request message from receiver application
to body and header -> extract file name and return it. | [
"Parse",
"received",
"file",
"request",
"message",
"from",
"receiver",
"application",
"to",
"body",
"and",
"header",
"-",
">",
"extract",
"file",
"name",
"and",
"return",
"it",
"."
] | def parse_file_request(self, data):
header, body = self.parse_data(data)
ret_dict = {}
if not str(chr(header[0])).isnumeric():
ret_dict["return"] = PARSE_RETURNS["wrong_message_type"]
return ret_dict
message_type = int(str(chr(int(header[0]))))
if message_... | [
"def",
"parse_file_request",
"(",
"self",
",",
"data",
")",
":",
"header",
",",
"body",
"=",
"self",
".",
"parse_data",
"(",
"data",
")",
"ret_dict",
"=",
"{",
"}",
"if",
"not",
"str",
"(",
"chr",
"(",
"header",
"[",
"0",
"]",
")",
")",
".",
"isn... | Parse received file request message from receiver application
to body and header -> extract file name and return it. | [
"Parse",
"received",
"file",
"request",
"message",
"from",
"receiver",
"application",
"to",
"body",
"and",
"header",
"-",
">",
"extract",
"file",
"name",
"and",
"return",
"it",
"."
] | [
"''' Parse received file request message from receiver application\r\n to body and header -> extract file name and return it. '''",
"# NET DERPER CHANGES FIRST NUM TO CHAR\r",
"# Check message type\r",
"# print(f\"TESTING MESSAGE TYPE : {message_type}, before: {header[0]}\")\r",
"# Check CRC\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
04060900fff1e0bbe7216166f9322ae1a210b9f3 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_sender.py | [
"MIT"
] | Python | MESSAGE_file_exists | <not_specific> | def MESSAGE_file_exists(self):
''' This function returns byte array of full message
to be sent as response to ~ file exists in server file system '''
# Get file size
self.file_byte_size = os.path.getsize(self.path_to_file)
print(f"GETTING FILE SIZE OF : {self.path_... | This function returns byte array of full message
to be sent as response to ~ file exists in server file system | This function returns byte array of full message
to be sent as response to ~ file exists in server file system | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"response",
"to",
"~",
"file",
"exists",
"in",
"server",
"file",
"system"
] | def MESSAGE_file_exists(self):
self.file_byte_size = os.path.getsize(self.path_to_file)
print(f"GETTING FILE SIZE OF : {self.path_to_file}... its: {os.path.getsize(self.path_to_file)}")
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str(MESSAGE_TYPES['f... | [
"def",
"MESSAGE_file_exists",
"(",
"self",
")",
":",
"self",
".",
"file_byte_size",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"self",
".",
"path_to_file",
")",
"print",
"(",
"f\"GETTING FILE SIZE OF : {self.path_to_file}... its: {os.path.getsize(self.path_to_file)}\"",... | This function returns byte array of full message
to be sent as response to ~ file exists in server file system | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"response",
"to",
"~",
"file",
"exists",
"in",
"server",
"file",
"system"
] | [
"''' This function returns byte array of full message\r\n to be sent as response to ~ file exists in server file system '''",
"# Get file size\r",
"## Write header\r",
"## Write body\r",
"# Convert file_byte_size to string and write the values to body\r",
"# Check if FILE_REQUEST_SUCCESSFUL_BODY_SI... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
04060900fff1e0bbe7216166f9322ae1a210b9f3 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_sender.py | [
"MIT"
] | Python | MESSAGE_file_doesnt_exists | <not_specific> | def MESSAGE_file_doesnt_exists(self):
''' This function returns byte array of full message
to be sent as response to ~ file doesnt exists in server file system '''
## Write header
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str... | This function returns byte array of full message
to be sent as response to ~ file doesnt exists in server file system | This function returns byte array of full message
to be sent as response to ~ file doesnt exists in server file system | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"response",
"to",
"~",
"file",
"doesnt",
"exists",
"in",
"server",
"file",
"system"
] | def MESSAGE_file_doesnt_exists(self):
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str(MESSAGE_TYPES['file_request_unsuccessful']))
body = self.get_empty_body(body_byte_size=FILE_REQUEST_UNSUCCESSFUL_BODY_SIZE)
message_without_crc = np.concatenate((he... | [
"def",
"MESSAGE_file_doesnt_exists",
"(",
"self",
")",
":",
"header",
"=",
"self",
".",
"get_empty_header",
"(",
"header_byte_size",
"=",
"self",
".",
"header_size",
")",
"header",
"[",
"0",
"]",
"=",
"ord",
"(",
"str",
"(",
"MESSAGE_TYPES",
"[",
"'file_requ... | This function returns byte array of full message
to be sent as response to ~ file doesnt exists in server file system | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"response",
"to",
"~",
"file",
"doesnt",
"exists",
"in",
"server",
"file",
"system"
] | [
"''' This function returns byte array of full message\r\n to be sent as response to ~ file doesnt exists in server file system '''",
"## Write header\r",
"## Write body\r",
"# Write in crc at the end of the body\r"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
04060900fff1e0bbe7216166f9322ae1a210b9f3 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_sender.py | [
"MIT"
] | Python | MESSAGE_file_data | <not_specific> | def MESSAGE_file_data(self, body, transfer_window_idx):
''' This function returns wrapped message i.e. header+body
for file transfer where body is the file data '''
# Get file size
self.file_byte_size = os.path.getsize(self.path_to_file)
## Write hea... | This function returns wrapped message i.e. header+body
for file transfer where body is the file data | This function returns wrapped message i.e. header+body
for file transfer where body is the file data | [
"This",
"function",
"returns",
"wrapped",
"message",
"i",
".",
"e",
".",
"header",
"+",
"body",
"for",
"file",
"transfer",
"where",
"body",
"is",
"the",
"file",
"data"
] | def MESSAGE_file_data(self, body, transfer_window_idx):
self.file_byte_size = os.path.getsize(self.path_to_file)
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str(MESSAGE_TYPES['file_data_sent']))
ASCII_number = str(transfer_window_idx)
if not ... | [
"def",
"MESSAGE_file_data",
"(",
"self",
",",
"body",
",",
"transfer_window_idx",
")",
":",
"self",
".",
"file_byte_size",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"self",
".",
"path_to_file",
")",
"header",
"=",
"self",
".",
"get_empty_header",
"(",
"... | This function returns wrapped message i.e. | [
"This",
"function",
"returns",
"wrapped",
"message",
"i",
".",
"e",
"."
] | [
"''' This function returns wrapped message i.e. header+body \r\n for file transfer where body is the file data '''",
"# Get file size\r",
"## Write header\r",
"# PACKET NUMBER IN HEADER\r",
"# Save information about transfer window idx in header\r",
"# Check if FILE_REQUEST_SUCCESSFUL_BODY_SIZE... | [
{
"param": "self",
"type": null
},
{
"param": "body",
"type": null
},
{
"param": "transfer_window_idx",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "body",
"type": null,
"docstring": null,
"docstring_tokens": [... |
04060900fff1e0bbe7216166f9322ae1a210b9f3 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_sender.py | [
"MIT"
] | Python | MESSAGE_hash | <not_specific> | def MESSAGE_hash(self, hash):
''' This function returns byte array of full message
to be sent as response to ~ file exists in server file system '''
## Write header
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str(MESSAGE_TYPES[... | This function returns byte array of full message
to be sent as response to ~ file exists in server file system | This function returns byte array of full message
to be sent as response to ~ file exists in server file system | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"response",
"to",
"~",
"file",
"exists",
"in",
"server",
"file",
"system"
] | def MESSAGE_hash(self, hash):
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str(MESSAGE_TYPES['file_hash']))
body = self.get_empty_body(body_byte_size=FILE_DATA_HASH_MESSAGE_BODY_SIZE)
for hash_byte_val_idx in range(HASH_LENGTH):
body[hash_... | [
"def",
"MESSAGE_hash",
"(",
"self",
",",
"hash",
")",
":",
"header",
"=",
"self",
".",
"get_empty_header",
"(",
"header_byte_size",
"=",
"self",
".",
"header_size",
")",
"header",
"[",
"0",
"]",
"=",
"ord",
"(",
"str",
"(",
"MESSAGE_TYPES",
"[",
"'file_h... | This function returns byte array of full message
to be sent as response to ~ file exists in server file system | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"response",
"to",
"~",
"file",
"exists",
"in",
"server",
"file",
"system"
] | [
"''' This function returns byte array of full message\r\n to be sent as response to ~ file exists in server file system '''",
"## Write header\r",
"## Write body\r",
"# Write hash into the body\r",
"# Write in crc at the end of the body\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "hash",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hash",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4bb8edc97dc143fd2a6c637ee7ba87b5f5965353 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_receiver.py | [
"MIT"
] | Python | parse_data | <not_specific> | def parse_data(self, data, int_format=True):
''' Parse data to int array and return header and body. '''
data_array = []
for byte_idx, byte in enumerate(data):
if int_format:
data_array.append(int(byte))
else:
data_array.append(byte... | Parse data to int array and return header and body. | Parse data to int array and return header and body. | [
"Parse",
"data",
"to",
"int",
"array",
"and",
"return",
"header",
"and",
"body",
"."
] | def parse_data(self, data, int_format=True):
data_array = []
for byte_idx, byte in enumerate(data):
if int_format:
data_array.append(int(byte))
else:
data_array.append(byte)
header = data_array[0:HEADER_SIZE]
body = data_array[HE... | [
"def",
"parse_data",
"(",
"self",
",",
"data",
",",
"int_format",
"=",
"True",
")",
":",
"data_array",
"=",
"[",
"]",
"for",
"byte_idx",
",",
"byte",
"in",
"enumerate",
"(",
"data",
")",
":",
"if",
"int_format",
":",
"data_array",
".",
"append",
"(",
... | Parse data to int array and return header and body. | [
"Parse",
"data",
"to",
"int",
"array",
"and",
"return",
"header",
"and",
"body",
"."
] | [
"''' Parse data to int array and return header and body. '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "int_format",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4bb8edc97dc143fd2a6c637ee7ba87b5f5965353 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_receiver.py | [
"MIT"
] | Python | parse_file_request_response | <not_specific> | def parse_file_request_response(self, data):
''' Parse received file request response message from receiver application
to body and header -> extract file size and return True if
file was found else return False '''
header, body = self.parse_data(data)
ret_dict = {... | Parse received file request response message from receiver application
to body and header -> extract file size and return True if
file was found else return False | Parse received file request response message from receiver application
to body and header -> extract file size and return True if
file was found else return False | [
"Parse",
"received",
"file",
"request",
"response",
"message",
"from",
"receiver",
"application",
"to",
"body",
"and",
"header",
"-",
">",
"extract",
"file",
"size",
"and",
"return",
"True",
"if",
"file",
"was",
"found",
"else",
"return",
"False"
] | def parse_file_request_response(self, data):
header, body = self.parse_data(data)
ret_dict = {}
if not str(chr(header[0])).isnumeric():
ret_dict["return"] = PARSE_RETURNS["wrong_message_type"]
return ret_dict
message_type = int(str(chr(header[0])))
if ord(... | [
"def",
"parse_file_request_response",
"(",
"self",
",",
"data",
")",
":",
"header",
",",
"body",
"=",
"self",
".",
"parse_data",
"(",
"data",
")",
"ret_dict",
"=",
"{",
"}",
"if",
"not",
"str",
"(",
"chr",
"(",
"header",
"[",
"0",
"]",
")",
")",
".... | Parse received file request response message from receiver application
to body and header -> extract file size and return True if
file was found else return False | [
"Parse",
"received",
"file",
"request",
"response",
"message",
"from",
"receiver",
"application",
"to",
"body",
"and",
"header",
"-",
">",
"extract",
"file",
"size",
"and",
"return",
"True",
"if",
"file",
"was",
"found",
"else",
"return",
"False"
] | [
"''' Parse received file request response message from receiver application\r\n to body and header -> extract file size and return True if\r\n file was found else return False '''",
"# NET DERPER CHANGES FIRST NUM TO CHAR\r",
"# Check CRC\r",
"# pop_zeros(body)\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4bb8edc97dc143fd2a6c637ee7ba87b5f5965353 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_receiver.py | [
"MIT"
] | Python | parse_file_hash_response | <not_specific> | def parse_file_hash_response(self, data):
''' Parse received file hash message from receiver application '''
header, body = self.parse_data(data)
ret_dict = {}
# NET DERPER CHANGES FIRST NUM TO CHAR
if not str(chr(header[0])).isnumeric():
ret_dict["return"] ... | Parse received file hash message from receiver application | Parse received file hash message from receiver application | [
"Parse",
"received",
"file",
"hash",
"message",
"from",
"receiver",
"application"
] | def parse_file_hash_response(self, data):
header, body = self.parse_data(data)
ret_dict = {}
if not str(chr(header[0])).isnumeric():
ret_dict["return"] = PARSE_RETURNS["wrong_message_type"]
return ret_dict
message_type = int(str(chr(header[0])))
if ord(chr... | [
"def",
"parse_file_hash_response",
"(",
"self",
",",
"data",
")",
":",
"header",
",",
"body",
"=",
"self",
".",
"parse_data",
"(",
"data",
")",
"ret_dict",
"=",
"{",
"}",
"if",
"not",
"str",
"(",
"chr",
"(",
"header",
"[",
"0",
"]",
")",
")",
".",
... | Parse received file hash message from receiver application | [
"Parse",
"received",
"file",
"hash",
"message",
"from",
"receiver",
"application"
] | [
"''' Parse received file hash message from receiver application '''",
"# NET DERPER CHANGES FIRST NUM TO CHAR\r",
"# Check CRC\r"
] | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4bb8edc97dc143fd2a6c637ee7ba87b5f5965353 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_receiver.py | [
"MIT"
] | Python | parse_file_data | <not_specific> | def parse_file_data(self, data):
''' Parse received file data from sender application
to body and header, check corruption as well. '''
header, skip = self.parse_data(data, int_format=False)
body = data[HEADER_SIZE:]
ret_dict = {}
ret_dict["valid"] = False
... | Parse received file data from sender application
to body and header, check corruption as well. | Parse received file data from sender application
to body and header, check corruption as well. | [
"Parse",
"received",
"file",
"data",
"from",
"sender",
"application",
"to",
"body",
"and",
"header",
"check",
"corruption",
"as",
"well",
"."
] | def parse_file_data(self, data):
header, skip = self.parse_data(data, int_format=False)
body = data[HEADER_SIZE:]
ret_dict = {}
ret_dict["valid"] = False
ret_dict["body"] = []
ret_dict["body_len"] = 0
ret_dict["parsed_transfer_window_idx"] = 0
if not str(c... | [
"def",
"parse_file_data",
"(",
"self",
",",
"data",
")",
":",
"header",
",",
"skip",
"=",
"self",
".",
"parse_data",
"(",
"data",
",",
"int_format",
"=",
"False",
")",
"body",
"=",
"data",
"[",
"HEADER_SIZE",
":",
"]",
"ret_dict",
"=",
"{",
"}",
"ret... | Parse received file data from sender application
to body and header, check corruption as well. | [
"Parse",
"received",
"file",
"data",
"from",
"sender",
"application",
"to",
"body",
"and",
"header",
"check",
"corruption",
"as",
"well",
"."
] | [
"''' Parse received file data from sender application\r\n to body and header, check corruption as well. '''",
"# NET DERPER CHANGES FIRST NUM TO CHAR\r",
"# Check CRC\r",
"## GET INFO FROM HEADER\r",
"# Get message window idx\r",
"# if header_int_char == 0: break\r",
"# Length of data in the ... | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4bb8edc97dc143fd2a6c637ee7ba87b5f5965353 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_receiver.py | [
"MIT"
] | Python | MESSAGE_check_file_exists | <not_specific> | def MESSAGE_check_file_exists(self):
''' This function returns byte array of full message
to be sent as request to check if file exists in the server filesystem,
in body there is ASCII chars of the file name requested '''
## Write header
header = self.get_empty_hea... | This function returns byte array of full message
to be sent as request to check if file exists in the server filesystem,
in body there is ASCII chars of the file name requested | This function returns byte array of full message
to be sent as request to check if file exists in the server filesystem,
in body there is ASCII chars of the file name requested | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"request",
"to",
"check",
"if",
"file",
"exists",
"in",
"the",
"server",
"filesystem",
"in",
"body",
"there",
"is",
"ASCII",
"chars",
"of",
"the",
"file",
... | def MESSAGE_check_file_exists(self):
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str(MESSAGE_TYPES['file_request']))
ASCII_file_name = str(self.path_to_file)
body = self.get_empty_body(body_byte_size=FILE_REQUEST_BODY_SIZE)
if not len(ASCII_f... | [
"def",
"MESSAGE_check_file_exists",
"(",
"self",
")",
":",
"header",
"=",
"self",
".",
"get_empty_header",
"(",
"header_byte_size",
"=",
"self",
".",
"header_size",
")",
"header",
"[",
"0",
"]",
"=",
"ord",
"(",
"str",
"(",
"MESSAGE_TYPES",
"[",
"'file_reque... | This function returns byte array of full message
to be sent as request to check if file exists in the server filesystem,
in body there is ASCII chars of the file name requested | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"request",
"to",
"check",
"if",
"file",
"exists",
"in",
"the",
"server",
"filesystem",
"in",
"body",
"there",
"is",
"ASCII",
"chars",
"of",
"the",
"file",
... | [
"''' This function returns byte array of full message\r\n to be sent as request to check if file exists in the server filesystem,\r\n in body there is ASCII chars of the file name requested '''",
"## Write header\r",
"## Write body\r",
"# write filename\r",
"#len(ASCII_file_name))\r",
"# Ite... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4bb8edc97dc143fd2a6c637ee7ba87b5f5965353 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_receiver.py | [
"MIT"
] | Python | MESSAGE_start_transfer | <not_specific> | def MESSAGE_start_transfer(self):
''' This function returns byte array of full message
to be sent as request to transfering file data '''
## Write header
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str(MESSAGE_TYPES['file_start... | This function returns byte array of full message
to be sent as request to transfering file data | This function returns byte array of full message
to be sent as request to transfering file data | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"request",
"to",
"transfering",
"file",
"data"
] | def MESSAGE_start_transfer(self):
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str(MESSAGE_TYPES['file_start_transfer']))
body = self.get_empty_body(body_byte_size=FILE_START_TRANSFER_BODY_SIZE)
message_without_crc = np.concatenate((header, body), axi... | [
"def",
"MESSAGE_start_transfer",
"(",
"self",
")",
":",
"header",
"=",
"self",
".",
"get_empty_header",
"(",
"header_byte_size",
"=",
"self",
".",
"header_size",
")",
"header",
"[",
"0",
"]",
"=",
"ord",
"(",
"str",
"(",
"MESSAGE_TYPES",
"[",
"'file_start_tr... | This function returns byte array of full message
to be sent as request to transfering file data | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"request",
"to",
"transfering",
"file",
"data"
] | [
"''' This function returns byte array of full message\r\n to be sent as request to transfering file data '''",
"## Write header\r",
"## Write body\r",
"# Iterate path to file and save the ASCII chars to array\r",
"# Write in crc at the end of the body\r"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4bb8edc97dc143fd2a6c637ee7ba87b5f5965353 | PeterKillerio/Reliable_data_transfer_with_UDP_and_Python | UDPFile_receiver.py | [
"MIT"
] | Python | MESSAGE_acknowledge | <not_specific> | def MESSAGE_acknowledge(self, valid, transfer_window_idx):
''' This function returns byte array of full message
to be sent as acknowledge to data transfer '''
## Write header
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str(MESS... | This function returns byte array of full message
to be sent as acknowledge to data transfer | This function returns byte array of full message
to be sent as acknowledge to data transfer | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"acknowledge",
"to",
"data",
"transfer"
] | def MESSAGE_acknowledge(self, valid, transfer_window_idx):
header = self.get_empty_header(header_byte_size=self.header_size)
header[0] = ord(str(MESSAGE_TYPES['file_data_acknowledge']))
header[1] = ord('1') if valid else ord('2')
ASCII_number = str(transfer_window_idx)
if not len... | [
"def",
"MESSAGE_acknowledge",
"(",
"self",
",",
"valid",
",",
"transfer_window_idx",
")",
":",
"header",
"=",
"self",
".",
"get_empty_header",
"(",
"header_byte_size",
"=",
"self",
".",
"header_size",
")",
"header",
"[",
"0",
"]",
"=",
"ord",
"(",
"str",
"... | This function returns byte array of full message
to be sent as acknowledge to data transfer | [
"This",
"function",
"returns",
"byte",
"array",
"of",
"full",
"message",
"to",
"be",
"sent",
"as",
"acknowledge",
"to",
"data",
"transfer"
] | [
"''' This function returns byte array of full message\r\n to be sent as acknowledge to data transfer '''",
"## Write header\r",
"# Write ascii number of requiered transfer_window_idx to 2-8th byte idx\r",
"# Convert file_byte_size to string and write the values to body\r",
"# Check if FILE_REQUEST_SU... | [
{
"param": "self",
"type": null
},
{
"param": "valid",
"type": null
},
{
"param": "transfer_window_idx",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "valid",
"type": null,
"docstring": null,
"docstring_tokens": ... |
9a348029723c8fff98af365c959a62fa160b6942 | KevinFerin/SCB | SCBert/SCBert.py | [
"MIT"
] | Python | tokenize | <not_specific> | def tokenize (self, data, MAX_LEN = 256) :
"""
This function call the tokenizer corresponding to the BERT model specified in the constructor. Then it generates
a vector of id corresponding to the words in the vocabulary. Also an attention vector which has the same size as the vector ... |
This function call the tokenizer corresponding to the BERT model specified in the constructor. Then it generates
a vector of id corresponding to the words in the vocabulary. Also an attention vector which has the same size as the vector of id with ones
for real words and zeros corr... | This function call the tokenizer corresponding to the BERT model specified in the constructor. Then it generates
a vector of id corresponding to the words in the vocabulary. Also an attention vector which has the same size as the vector of id with ones
for real words and zeros corresponding to padding id.
Parameters
... | [
"This",
"function",
"call",
"the",
"tokenizer",
"corresponding",
"to",
"the",
"BERT",
"model",
"specified",
"in",
"the",
"constructor",
".",
"Then",
"it",
"generates",
"a",
"vector",
"of",
"id",
"corresponding",
"to",
"the",
"words",
"in",
"the",
"vocabulary",... | def tokenize (self, data, MAX_LEN = 256) :
tokenized_texts = np.array([self.tokenizer.tokenize(text) for text in data])
input_ids = np.array([self.tokenizer.encode(text, max_length=MAX_LEN, pad_to_max_length=True, add_special_tokens= True ) for text in data])
attention_masks = []
... | [
"def",
"tokenize",
"(",
"self",
",",
"data",
",",
"MAX_LEN",
"=",
"256",
")",
":",
"tokenized_texts",
"=",
"np",
".",
"array",
"(",
"[",
"self",
".",
"tokenizer",
".",
"tokenize",
"(",
"text",
")",
"for",
"text",
"in",
"data",
"]",
")",
"input_ids",
... | This function call the tokenizer corresponding to the BERT model specified in the constructor. | [
"This",
"function",
"call",
"the",
"tokenizer",
"corresponding",
"to",
"the",
"BERT",
"model",
"specified",
"in",
"the",
"constructor",
"."
] | [
"\"\"\"\n This function call the tokenizer corresponding to the BERT model specified in the constructor. Then it generates\n a vector of id corresponding to the words in the vocabulary. Also an attention vector which has the same size as the vector of id with ones \n for real words ... | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "MAX_LEN",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
9a348029723c8fff98af365c959a62fa160b6942 | KevinFerin/SCB | SCBert/SCBert.py | [
"MIT"
] | Python | __sentence_pooling | <not_specific> | def __sentence_pooling (self, vectors , pooling_method) :
"""
Parameters
----------
vectors : list of vectors representing each words including the BOS and EOS tag
pooling_method : string
average or max.
Returns
... |
Parameters
----------
vectors : list of vectors representing each words including the BOS and EOS tag
pooling_method : string
average or max.
Returns
-------
pooled_vectors : tensor
pooled... | Parameters
vectors : list of vectors representing each words including the BOS and EOS tag
pooling_method : string
average or max.
Returns
pooled_vectors : tensor
pooled tensors according to the method. | [
"Parameters",
"vectors",
":",
"list",
"of",
"vectors",
"representing",
"each",
"words",
"including",
"the",
"BOS",
"and",
"EOS",
"tag",
"pooling_method",
":",
"string",
"average",
"or",
"max",
".",
"Returns",
"pooled_vectors",
":",
"tensor",
"pooled",
"tensors",... | def __sentence_pooling (self, vectors , pooling_method) :
pooled_vector = torch.tensor([])
if pooling_method.lower() == "average" :
pooled_vector = torch.mean(vectors, axis=0)
elif pooling_method.lower() == "max" :
pooled_vector = torch.max(vectors, ax... | [
"def",
"__sentence_pooling",
"(",
"self",
",",
"vectors",
",",
"pooling_method",
")",
":",
"pooled_vector",
"=",
"torch",
".",
"tensor",
"(",
"[",
"]",
")",
"if",
"pooling_method",
".",
"lower",
"(",
")",
"==",
"\"average\"",
":",
"pooled_vector",
"=",
"to... | Parameters
vectors : list of vectors representing each words including the BOS and EOS tag | [
"Parameters",
"vectors",
":",
"list",
"of",
"vectors",
"representing",
"each",
"words",
"including",
"the",
"BOS",
"and",
"EOS",
"tag"
] | [
"\"\"\"\n Parameters\n ----------\n vectors : list of vectors representing each words including the BOS and EOS tag\n \n pooling_method : string\n average or max.\n\n Returns\n -------\n pooled_vectors : tensor \n... | [
{
"param": "self",
"type": null
},
{
"param": "vectors",
"type": null
},
{
"param": "pooling_method",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vectors",
"type": null,
"docstring": null,
"docstring_tokens"... |
9a348029723c8fff98af365c959a62fa160b6942 | KevinFerin/SCB | SCBert/SCBert.py | [
"MIT"
] | Python | __word_pooling | <not_specific> | def __word_pooling (self, encoded_layers_b, layers, idx, pooling_method, MAX_LEN = 256) :
"""
Parameters
----------
vectors : list of vectors representing each words including the BOS and EOS tag
pooling_method : string
average, m... |
Parameters
----------
vectors : list of vectors representing each words including the BOS and EOS tag
pooling_method : string
average, max or concat.
MAX_LEN : int, optional
Corresponds to the max ... | Parameters
vectors : list of vectors representing each words including the BOS and EOS tag
pooling_method : string
average, max or concat.
MAX_LEN : int, optional
Corresponds to the max number of word to take into account during tokenizing. If a text is 350 words long and
MAX_LEN is 256, the text will be truncated af... | [
"Parameters",
"vectors",
":",
"list",
"of",
"vectors",
"representing",
"each",
"words",
"including",
"the",
"BOS",
"and",
"EOS",
"tag",
"pooling_method",
":",
"string",
"average",
"max",
"or",
"concat",
".",
"MAX_LEN",
":",
"int",
"optional",
"Corresponds",
"t... | def __word_pooling (self, encoded_layers_b, layers, idx, pooling_method, MAX_LEN = 256) :
pooled_words = torch.tensor([])
if pooling_method.lower() == "concat" :
for layer in layers :
pooled_words = torch.cat((pooled_words, encoded_layers_b[layer][idx]), d... | [
"def",
"__word_pooling",
"(",
"self",
",",
"encoded_layers_b",
",",
"layers",
",",
"idx",
",",
"pooling_method",
",",
"MAX_LEN",
"=",
"256",
")",
":",
"pooled_words",
"=",
"torch",
".",
"tensor",
"(",
"[",
"]",
")",
"if",
"pooling_method",
".",
"lower",
... | Parameters
vectors : list of vectors representing each words including the BOS and EOS tag | [
"Parameters",
"vectors",
":",
"list",
"of",
"vectors",
"representing",
"each",
"words",
"including",
"the",
"BOS",
"and",
"EOS",
"tag"
] | [
"\"\"\"\n Parameters\n ----------\n vectors : list of vectors representing each words including the BOS and EOS tag\n \n pooling_method : string\n average, max or concat.\n \n MAX_LEN : int, optional\n Cor... | [
{
"param": "self",
"type": null
},
{
"param": "encoded_layers_b",
"type": null
},
{
"param": "layers",
"type": null
},
{
"param": "idx",
"type": null
},
{
"param": "pooling_method",
"type": null
},
{
"param": "MAX_LEN",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "encoded_layers_b",
"type": null,
"docstring": null,
"docstrin... |
9a348029723c8fff98af365c959a62fa160b6942 | KevinFerin/SCB | SCBert/SCBert.py | [
"MIT"
] | Python | forward_and_pool | <not_specific> | def forward_and_pool (self, input_ids_tensor, masks_tensor, sentence_pooling_method="average", word_pooling_method="average", layers = 11, batch_size=50, path_to_save=None) :
"""
This function execute the forward pass of the input data into the BERT model and create a unique tensor for each inpu... |
This function execute the forward pass of the input data into the BERT model and create a unique tensor for each input according to the stated pooling methods.
Parameters
----------
input_ids_tensor : tensor
Corresponds to then= ids of token... | This function execute the forward pass of the input data into the BERT model and create a unique tensor for each input according to the stated pooling methods.
Parameters
input_ids_tensor : tensor
Corresponds to then= ids of tokenized words.
Must match the output of the tokenize function.
masks_tensor : tensor
Corresp... | [
"This",
"function",
"execute",
"the",
"forward",
"pass",
"of",
"the",
"input",
"data",
"into",
"the",
"BERT",
"model",
"and",
"create",
"a",
"unique",
"tensor",
"for",
"each",
"input",
"according",
"to",
"the",
"stated",
"pooling",
"methods",
".",
"Parameter... | def forward_and_pool (self, input_ids_tensor, masks_tensor, sentence_pooling_method="average", word_pooling_method="average", layers = 11, batch_size=50, path_to_save=None) :
layer_list = False
if (sentence_pooling_method not in ["average", "max"]) :
raise ValueError('sentence_po... | [
"def",
"forward_and_pool",
"(",
"self",
",",
"input_ids_tensor",
",",
"masks_tensor",
",",
"sentence_pooling_method",
"=",
"\"average\"",
",",
"word_pooling_method",
"=",
"\"average\"",
",",
"layers",
"=",
"11",
",",
"batch_size",
"=",
"50",
",",
"path_to_save",
"... | This function execute the forward pass of the input data into the BERT model and create a unique tensor for each input according to the stated pooling methods. | [
"This",
"function",
"execute",
"the",
"forward",
"pass",
"of",
"the",
"input",
"data",
"into",
"the",
"BERT",
"model",
"and",
"create",
"a",
"unique",
"tensor",
"for",
"each",
"input",
"according",
"to",
"the",
"stated",
"pooling",
"methods",
"."
] | [
"\"\"\"\n This function execute the forward pass of the input data into the BERT model and create a unique tensor for each input according to the stated pooling methods. \n \n Parameters\n ----------\n input_ids_tensor : tensor\n Corresponds to t... | [
{
"param": "self",
"type": null
},
{
"param": "input_ids_tensor",
"type": null
},
{
"param": "masks_tensor",
"type": null
},
{
"param": "sentence_pooling_method",
"type": null
},
{
"param": "word_pooling_method",
"type": null
},
{
"param": "layers",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_ids_tensor",
"type": null,
"docstring": null,
"docstrin... |
9a348029723c8fff98af365c959a62fa160b6942 | KevinFerin/SCB | SCBert/SCBert.py | [
"MIT"
] | Python | vectorize | <not_specific> | def vectorize (self, data, MAX_LEN = 256,sentence_pooling_method="average", word_pooling_method="average", layers = 11, batch_size=50, path_to_save=None) :
"""
Transform the input raw data into tensors according to the selected models and the pooling methods.
Parameters... |
Transform the input raw data into tensors according to the selected models and the pooling methods.
Parameters
----------
data : `Numpy array` or `Pandas DataFrame`
Corresponds to your datas, must be a list of your texts texts.
... | Transform the input raw data into tensors according to the selected models and the pooling methods.
Parameters
data : `Numpy array` or `Pandas DataFrame`
Corresponds to your datas, must be a list of your texts texts.
MAX_LEN : int, optional
Corresponds to the max number of word to take into account during tokenizing.... | [
"Transform",
"the",
"input",
"raw",
"data",
"into",
"tensors",
"according",
"to",
"the",
"selected",
"models",
"and",
"the",
"pooling",
"methods",
".",
"Parameters",
"data",
":",
"`",
"Numpy",
"array",
"`",
"or",
"`",
"Pandas",
"DataFrame",
"`",
"Corresponds... | def vectorize (self, data, MAX_LEN = 256,sentence_pooling_method="average", word_pooling_method="average", layers = 11, batch_size=50, path_to_save=None) :
tokenized_texts, input_ids_tensor, masks_tensor = self.tokenize(data,MAX_LEN)
texts_vectors = self.forward_and_pool(input_ids_tensor,masks_t... | [
"def",
"vectorize",
"(",
"self",
",",
"data",
",",
"MAX_LEN",
"=",
"256",
",",
"sentence_pooling_method",
"=",
"\"average\"",
",",
"word_pooling_method",
"=",
"\"average\"",
",",
"layers",
"=",
"11",
",",
"batch_size",
"=",
"50",
",",
"path_to_save",
"=",
"N... | Transform the input raw data into tensors according to the selected models and the pooling methods. | [
"Transform",
"the",
"input",
"raw",
"data",
"into",
"tensors",
"according",
"to",
"the",
"selected",
"models",
"and",
"the",
"pooling",
"methods",
"."
] | [
"\"\"\"\n Transform the input raw data into tensors according to the selected models and the pooling methods. \n \n Parameters\n ----------\n data : `Numpy array` or `Pandas DataFrame`\n Corresponds to your datas, must be a list of your texts tex... | [
{
"param": "self",
"type": null
},
{
"param": "data",
"type": null
},
{
"param": "MAX_LEN",
"type": null
},
{
"param": "sentence_pooling_method",
"type": null
},
{
"param": "word_pooling_method",
"type": null
},
{
"param": "layers",
"type": null
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [... |
088f5415f42effb1b01f058a1f958b225cc166fb | marccgrau/template_project | src/download_raw_data.py | [
"MIT"
] | Python | grab_ons_time_series_data | <not_specific> | def grab_ons_time_series_data(dataset_id, timeseries_id):
""" Grabs specified time series from the ONS API. """
api_endpoint = "https://api.ons.gov.uk/"
api_params = {
'dataset': dataset_id,
'timeseries': timeseries_id
}
url = (api_endpoint +
... | Grabs specified time series from the ONS API. | Grabs specified time series from the ONS API. | [
"Grabs",
"specified",
"time",
"series",
"from",
"the",
"ONS",
"API",
"."
] | def grab_ons_time_series_data(dataset_id, timeseries_id):
api_endpoint = "https://api.ons.gov.uk/"
api_params = {
'dataset': dataset_id,
'timeseries': timeseries_id
}
url = (api_endpoint +
'/'.join([x+'/'+y for x, y in zip(api_params.keys(),
... | [
"def",
"grab_ons_time_series_data",
"(",
"dataset_id",
",",
"timeseries_id",
")",
":",
"api_endpoint",
"=",
"\"https://api.ons.gov.uk/\"",
"api_params",
"=",
"{",
"'dataset'",
":",
"dataset_id",
",",
"'timeseries'",
":",
"timeseries_id",
"}",
"url",
"=",
"(",
"api_e... | Grabs specified time series from the ONS API. | [
"Grabs",
"specified",
"time",
"series",
"from",
"the",
"ONS",
"API",
"."
] | [
"\"\"\" Grabs specified time series from the ONS API. \"\"\""
] | [
{
"param": "dataset_id",
"type": null
},
{
"param": "timeseries_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dataset_id",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timeseries_id",
"type": null,
"docstring": null,
"docst... |
088f5415f42effb1b01f058a1f958b225cc166fb | marccgrau/template_project | src/download_raw_data.py | [
"MIT"
] | Python | download_raw_data | null | def download_raw_data():
"""
Master script for download raw data from ONS
Writes out to rawFilePath in config
"""
config = utils.read_config()
# Retrieve all series and save to file with value name/key in title
for i, key in enumerate(config['timeSeries'].keys()):
print('Downloading ... |
Master script for download raw data from ONS
Writes out to rawFilePath in config
| Master script for download raw data from ONS
Writes out to rawFilePath in config | [
"Master",
"script",
"for",
"download",
"raw",
"data",
"from",
"ONS",
"Writes",
"out",
"to",
"rawFilePath",
"in",
"config"
] | def download_raw_data():
config = utils.read_config()
for i, key in enumerate(config['timeSeries'].keys()):
print('Downloading '+key)
data = grab_ons_time_series_data(*config['timeSeries'][key])
output_dir = os.path.join(
config['data']['rawFilePath'], key+'_data.txt')
... | [
"def",
"download_raw_data",
"(",
")",
":",
"config",
"=",
"utils",
".",
"read_config",
"(",
")",
"for",
"i",
",",
"key",
"in",
"enumerate",
"(",
"config",
"[",
"'timeSeries'",
"]",
".",
"keys",
"(",
")",
")",
":",
"print",
"(",
"'Downloading '",
"+",
... | Master script for download raw data from ONS
Writes out to rawFilePath in config | [
"Master",
"script",
"for",
"download",
"raw",
"data",
"from",
"ONS",
"Writes",
"out",
"to",
"rawFilePath",
"in",
"config"
] | [
"\"\"\"\n Master script for download raw data from ONS\n Writes out to rawFilePath in config\n \"\"\"",
"# Retrieve all series and save to file with value name/key in title"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
14fd2f37bcbb858f4609b83b0783e437d3811f40 | marccgrau/template_project | src/create_clean_data.py | [
"MIT"
] | Python | clean_ons_time_series | <not_specific> | def clean_ons_time_series(key, dataset_id, timeseries_id):
"""
Opens raw data (in json) as downloaded from ONS API
and puts it into a clean monthly and tidy format.
"""
config = utils.read_config()
raw_file_name = os.path.join(config['data']['rawFilePath'],
key+'... |
Opens raw data (in json) as downloaded from ONS API
and puts it into a clean monthly and tidy format.
| Opens raw data (in json) as downloaded from ONS API
and puts it into a clean monthly and tidy format. | [
"Opens",
"raw",
"data",
"(",
"in",
"json",
")",
"as",
"downloaded",
"from",
"ONS",
"API",
"and",
"puts",
"it",
"into",
"a",
"clean",
"monthly",
"and",
"tidy",
"format",
"."
] | def clean_ons_time_series(key, dataset_id, timeseries_id):
config = utils.read_config()
raw_file_name = os.path.join(config['data']['rawFilePath'],
key+'_data.txt')
with open(raw_file_name) as json_file:
data = json.load(json_file)
title_text = data['description'... | [
"def",
"clean_ons_time_series",
"(",
"key",
",",
"dataset_id",
",",
"timeseries_id",
")",
":",
"config",
"=",
"utils",
".",
"read_config",
"(",
")",
"raw_file_name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"config",
"[",
"'data'",
"]",
"[",
"'rawFilePath... | Opens raw data (in json) as downloaded from ONS API
and puts it into a clean monthly and tidy format. | [
"Opens",
"raw",
"data",
"(",
"in",
"json",
")",
"as",
"downloaded",
"from",
"ONS",
"API",
"and",
"puts",
"it",
"into",
"a",
"clean",
"monthly",
"and",
"tidy",
"format",
"."
] | [
"\"\"\"\n Opens raw data (in json) as downloaded from ONS API\n and puts it into a clean monthly and tidy format.\n \"\"\"",
"# Check if monthly data exist; if not go on to quarterly",
"# Assume quarterly",
"# Upscale to monthly"
] | [
{
"param": "key",
"type": null
},
{
"param": "dataset_id",
"type": null
},
{
"param": "timeseries_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "key",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dataset_id",
"type": null,
"docstring": null,
"docstring_token... |
14fd2f37bcbb858f4609b83b0783e437d3811f40 | marccgrau/template_project | src/create_clean_data.py | [
"MIT"
] | Python | create_clean_data | null | def create_clean_data():
"""
Master function which takes all raw series, cleans them,
and outputs to a flat file
"""
# Get config file
config = utils.read_config()
# Create empty list for vector of dataframes
df_vec = []
for key in list(config['timeSeries'].keys()):
df_vec.ap... |
Master function which takes all raw series, cleans them,
and outputs to a flat file
| Master function which takes all raw series, cleans them,
and outputs to a flat file | [
"Master",
"function",
"which",
"takes",
"all",
"raw",
"series",
"cleans",
"them",
"and",
"outputs",
"to",
"a",
"flat",
"file"
] | def create_clean_data():
config = utils.read_config()
df_vec = []
for key in list(config['timeSeries'].keys()):
df_vec.append(clean_ons_time_series(key, *config['timeSeries'][key]))
df = pd.concat(df_vec, axis=0)
df.to_csv(os.path.join(config['data']['clnFilePath'], 'ts_data.csv')) | [
"def",
"create_clean_data",
"(",
")",
":",
"config",
"=",
"utils",
".",
"read_config",
"(",
")",
"df_vec",
"=",
"[",
"]",
"for",
"key",
"in",
"list",
"(",
"config",
"[",
"'timeSeries'",
"]",
".",
"keys",
"(",
")",
")",
":",
"df_vec",
".",
"append",
... | Master function which takes all raw series, cleans them,
and outputs to a flat file | [
"Master",
"function",
"which",
"takes",
"all",
"raw",
"series",
"cleans",
"them",
"and",
"outputs",
"to",
"a",
"flat",
"file"
] | [
"\"\"\"\n Master function which takes all raw series, cleans them,\n and outputs to a flat file\n \"\"\"",
"# Get config file",
"# Create empty list for vector of dataframes",
"# Put this into tidy format",
"# Write it to clean data"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e6c16073df09826da9b9661576eb04a1b0864032 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/plot-results2.py | [
"Apache-2.0"
] | Python | read_results_file | <not_specific> | def read_results_file(filename):
""" Read the results from a file and returns them as structured numpy array
The order is (number_nodes, number_procs, numfreqw, time in sec)
:param filename: filename
:return: List of tuples as above
"""
d=numpy.loadtxt('%s/%s' %(results_dir,filename),
... | Read the results from a file and returns them as structured numpy array
The order is (number_nodes, number_procs, numfreqw, time in sec)
:param filename: filename
:return: List of tuples as above
| Read the results from a file and returns them as structured numpy array
The order is (number_nodes, number_procs, numfreqw, time in sec) | [
"Read",
"the",
"results",
"from",
"a",
"file",
"and",
"returns",
"them",
"as",
"structured",
"numpy",
"array",
"The",
"order",
"is",
"(",
"number_nodes",
"number_procs",
"numfreqw",
"time",
"in",
"sec",
")"
] | def read_results_file(filename):
d=numpy.loadtxt('%s/%s' %(results_dir,filename),
dtype={'names': ('numnodes','numprocs','pipeline','time'),
'formats': ('i','i','i','f')},
delimiter='\t')
print(d)
return d | [
"def",
"read_results_file",
"(",
"filename",
")",
":",
"d",
"=",
"numpy",
".",
"loadtxt",
"(",
"'%s/%s'",
"%",
"(",
"results_dir",
",",
"filename",
")",
",",
"dtype",
"=",
"{",
"'names'",
":",
"(",
"'numnodes'",
",",
"'numprocs'",
",",
"'pipeline'",
",",... | Read the results from a file and returns them as structured numpy array
The order is (number_nodes, number_procs, numfreqw, time in sec) | [
"Read",
"the",
"results",
"from",
"a",
"file",
"and",
"returns",
"them",
"as",
"structured",
"numpy",
"array",
"The",
"order",
"is",
"(",
"number_nodes",
"number_procs",
"numfreqw",
"time",
"in",
"sec",
")"
] | [
"\"\"\" Read the results from a file and returns them as structured numpy array\n The order is (number_nodes, number_procs, numfreqw, time in sec)\n :param filename: filename\n :return: List of tuples as above\n \"\"\"",
"#dtype={'names': ('numnodes','numprocs','nfreqw','time'),"
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": "List of tuples as above",
"docstring_tokens": [
"List",
"of",
"tuples",
"as",
"above"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring":... |
308b8c1652969b667f17f589e8e6326debed374e | ska-telescope/algorithm-reference-library | data_models/parameters.py | [
"Apache-2.0"
] | Python | arl_path | <not_specific> | def arl_path(path):
"""Converts a path that might be relative to ARL root into an
absolute path::
arl_path('data/models/SKA1_LOW_beam.fits')
'/Users/timcornwell/Code/algorithm-reference-library/data/models/SKA1_LOW_beam.fits'
:param path:
:return: absolute path
"""
project_root... | Converts a path that might be relative to ARL root into an
absolute path::
arl_path('data/models/SKA1_LOW_beam.fits')
'/Users/timcornwell/Code/algorithm-reference-library/data/models/SKA1_LOW_beam.fits'
:param path:
:return: absolute path
| Converts a path that might be relative to ARL root into an
absolute path:.
| [
"Converts",
"a",
"path",
"that",
"might",
"be",
"relative",
"to",
"ARL",
"root",
"into",
"an",
"absolute",
"path",
":",
"."
] | def arl_path(path):
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
arlhome = os.getenv('ARL', project_root)
return os.path.join(arlhome, path) | [
"def",
"arl_path",
"(",
"path",
")",
":",
"project_root",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
")",
")",
"arlhome",
"=",
"os",
".",
"getenv",
... | Converts a path that might be relative to ARL root into an
absolute path:: | [
"Converts",
"a",
"path",
"that",
"might",
"be",
"relative",
"to",
"ARL",
"root",
"into",
"an",
"absolute",
"path",
"::"
] | [
"\"\"\"Converts a path that might be relative to ARL root into an\n absolute path::\n\n arl_path('data/models/SKA1_LOW_beam.fits')\n '/Users/timcornwell/Code/algorithm-reference-library/data/models/SKA1_LOW_beam.fits'\n\n :param path:\n :return: absolute path\n \"\"\""
] | [
{
"param": "path",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
0755ced348e11f49b7981f3016a38ac6eeca65dc | ska-telescope/algorithm-reference-library | processing_components/simulation/configurations.py | [
"Apache-2.0"
] | Python | limit_rmax | <not_specific> | def limit_rmax(antxyz, diameters, names, mounts, rmax):
""" Select antennas with radius from centre < rmax
:param antxyz:
:param diameters:
:param names:
:param mounts:
:param rmax:
:return:
"""
if rmax is not None:
lantxyz = antxyz - numpy.average(antxyz, axis=0)
... | Select antennas with radius from centre < rmax
:param antxyz:
:param diameters:
:param names:
:param mounts:
:param rmax:
:return:
| Select antennas with radius from centre < rmax | [
"Select",
"antennas",
"with",
"radius",
"from",
"centre",
"<",
"rmax"
] | def limit_rmax(antxyz, diameters, names, mounts, rmax):
if rmax is not None:
lantxyz = antxyz - numpy.average(antxyz, axis=0)
r = numpy.sqrt(lantxyz[:, 0] ** 2 + lantxyz[:, 1] ** 2 + lantxyz[:, 2] ** 2)
antxyz = antxyz[r < rmax]
log.debug('create_configuration_from_file: Maximum radi... | [
"def",
"limit_rmax",
"(",
"antxyz",
",",
"diameters",
",",
"names",
",",
"mounts",
",",
"rmax",
")",
":",
"if",
"rmax",
"is",
"not",
"None",
":",
"lantxyz",
"=",
"antxyz",
"-",
"numpy",
".",
"average",
"(",
"antxyz",
",",
"axis",
"=",
"0",
")",
"r"... | Select antennas with radius from centre < rmax | [
"Select",
"antennas",
"with",
"radius",
"from",
"centre",
"<",
"rmax"
] | [
"\"\"\" Select antennas with radius from centre < rmax\n \n :param antxyz:\n :param diameters:\n :param names:\n :param mounts:\n :param rmax:\n :return:\n \"\"\""
] | [
{
"param": "antxyz",
"type": null
},
{
"param": "diameters",
"type": null
},
{
"param": "names",
"type": null
},
{
"param": "mounts",
"type": null
},
{
"param": "rmax",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "antxyz",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
0755ced348e11f49b7981f3016a38ac6eeca65dc | ska-telescope/algorithm-reference-library | processing_components/simulation/configurations.py | [
"Apache-2.0"
] | Python | create_LOFAR_configuration | Configuration | def create_LOFAR_configuration(antfile: str, location, rmax=1e6) -> Configuration:
""" Define from the LOFAR configuration file
:param antfile:
:return: Configuration
"""
antxyz = numpy.genfromtxt(antfile, skip_header=2, usecols=[1, 2, 3], delimiter=",")
nants = antxyz.shape[0]
assert antxy... | Define from the LOFAR configuration file
:param antfile:
:return: Configuration
| Define from the LOFAR configuration file | [
"Define",
"from",
"the",
"LOFAR",
"configuration",
"file"
] | def create_LOFAR_configuration(antfile: str, location, rmax=1e6) -> Configuration:
antxyz = numpy.genfromtxt(antfile, skip_header=2, usecols=[1, 2, 3], delimiter=",")
nants = antxyz.shape[0]
assert antxyz.shape[1] == 3, "Antenna array has wrong shape %s" % antxyz.shape
anames = numpy.genfromtxt(antfile,... | [
"def",
"create_LOFAR_configuration",
"(",
"antfile",
":",
"str",
",",
"location",
",",
"rmax",
"=",
"1e6",
")",
"->",
"Configuration",
":",
"antxyz",
"=",
"numpy",
".",
"genfromtxt",
"(",
"antfile",
",",
"skip_header",
"=",
"2",
",",
"usecols",
"=",
"[",
... | Define from the LOFAR configuration file | [
"Define",
"from",
"the",
"LOFAR",
"configuration",
"file"
] | [
"\"\"\" Define from the LOFAR configuration file\n\n :param antfile:\n :return: Configuration\n \"\"\""
] | [
{
"param": "antfile",
"type": "str"
},
{
"param": "location",
"type": null
},
{
"param": "rmax",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "antfile",
"type": "str",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
8d453a4df33736a74490daa0d4fbc776aa7ca793 | ska-telescope/algorithm-reference-library | workflows/scripts/pipelines/performance/pipelines-timings/pipelines_arlexecute_timings.py | [
"Apache-2.0"
] | Python | git_hash | <not_specific> | def git_hash():
""" Get the hash for this git repository.
Requires that the code tree was created using git
:return: string or "unknown"
"""
import subprocess
try:
return subprocess.check_output(["git", "rev-parse", 'HEAD'])
except Exception as excp:
print(excp)
... | Get the hash for this git repository.
Requires that the code tree was created using git
:return: string or "unknown"
| Get the hash for this git repository.
Requires that the code tree was created using git | [
"Get",
"the",
"hash",
"for",
"this",
"git",
"repository",
".",
"Requires",
"that",
"the",
"code",
"tree",
"was",
"created",
"using",
"git"
] | def git_hash():
import subprocess
try:
return subprocess.check_output(["git", "rev-parse", 'HEAD'])
except Exception as excp:
print(excp)
return "unknown" | [
"def",
"git_hash",
"(",
")",
":",
"import",
"subprocess",
"try",
":",
"return",
"subprocess",
".",
"check_output",
"(",
"[",
"\"git\"",
",",
"\"rev-parse\"",
",",
"'HEAD'",
"]",
")",
"except",
"Exception",
"as",
"excp",
":",
"print",
"(",
"excp",
")",
"r... | Get the hash for this git repository. | [
"Get",
"the",
"hash",
"for",
"this",
"git",
"repository",
"."
] | [
"\"\"\" Get the hash for this git repository.\n \n Requires that the code tree was created using git\n \n :return: string or \"unknown\"\n \"\"\""
] | [] | {
"returns": [
{
"docstring": "string or \"unknown\"",
"docstring_tokens": [
"string",
"or",
"\"",
"unknown",
"\""
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
2c5d97b4d01a5f4a0cd89f9d88cd3598677f6907 | ska-telescope/algorithm-reference-library | processing_components/visibility/coalesce.py | [
"Apache-2.0"
] | Python | coalesce_visibility | Visibility | def coalesce_visibility(vis: BlockVisibility, **kwargs) -> Visibility:
""" Coalesce the BlockVisibility data_models. The output format is a Visibility, as needed for imaging
Coalesce by baseline-dependent averaging (optional). The number of integrations averaged goes as the ratio of the
maximum possible ba... | Coalesce the BlockVisibility data_models. The output format is a Visibility, as needed for imaging
Coalesce by baseline-dependent averaging (optional). The number of integrations averaged goes as the ratio of the
maximum possible baseline length to that for this baseline. This number can be scaled by coalesce... |
When faceting, the coalescence factors should be roughly the same as the number of facets on one axis.
If coalescence_factor=0.0 then just a format conversion is done | [
"When",
"faceting",
"the",
"coalescence",
"factors",
"should",
"be",
"roughly",
"the",
"same",
"as",
"the",
"number",
"of",
"facets",
"on",
"one",
"axis",
".",
"If",
"coalescence_factor",
"=",
"0",
".",
"0",
"then",
"just",
"a",
"format",
"conversion",
"is... | def coalesce_visibility(vis: BlockVisibility, **kwargs) -> Visibility:
assert isinstance(vis, BlockVisibility), "vis is not a BlockVisibility: %r" % vis
time_coal = get_parameter(kwargs, 'time_coal', 0.0)
max_time_coal = get_parameter(kwargs, 'max_time_coal', 100)
frequency_coal = get_parameter(kwargs, ... | [
"def",
"coalesce_visibility",
"(",
"vis",
":",
"BlockVisibility",
",",
"**",
"kwargs",
")",
"->",
"Visibility",
":",
"assert",
"isinstance",
"(",
"vis",
",",
"BlockVisibility",
")",
",",
"\"vis is not a BlockVisibility: %r\"",
"%",
"vis",
"time_coal",
"=",
"get_pa... | Coalesce the BlockVisibility data_models. | [
"Coalesce",
"the",
"BlockVisibility",
"data_models",
"."
] | [
"\"\"\" Coalesce the BlockVisibility data_models. The output format is a Visibility, as needed for imaging\n\n Coalesce by baseline-dependent averaging (optional). The number of integrations averaged goes as the ratio of the\n maximum possible baseline length to that for this baseline. This number can be scal... | [
{
"param": "vis",
"type": "BlockVisibility"
}
] | {
"returns": [
{
"docstring": "Coalesced visibility with cindex and blockvis filled in",
"docstring_tokens": [
"Coalesced",
"visibility",
"with",
"cindex",
"and",
"blockvis",
"filled",
"in"
],
"type": null
}
],
"raise... |
2c5d97b4d01a5f4a0cd89f9d88cd3598677f6907 | ska-telescope/algorithm-reference-library | processing_components/visibility/coalesce.py | [
"Apache-2.0"
] | Python | convert_blockvisibility_to_visibility | Visibility | def convert_blockvisibility_to_visibility(vis: BlockVisibility) -> Visibility:
""" Convert the BlockVisibility data with no coalescence
:param vis: BlockVisibility to be converted
:return: Visibility with cindex and blockvis filled in
"""
assert isinstance(vis, BlockVisibility), "vis is not a Blo... | Convert the BlockVisibility data with no coalescence
:param vis: BlockVisibility to be converted
:return: Visibility with cindex and blockvis filled in
| Convert the BlockVisibility data with no coalescence | [
"Convert",
"the",
"BlockVisibility",
"data",
"with",
"no",
"coalescence"
] | def convert_blockvisibility_to_visibility(vis: BlockVisibility) -> Visibility:
assert isinstance(vis, BlockVisibility), "vis is not a BlockVisibility: %r" % vis
cvis, cuvw, cwts, cimaging_wts, ctime, cfrequency, cchannel_bandwidth, ca1, ca2, cintegration_time, cindex \
= convert_blocks(vis.data['vis'], ... | [
"def",
"convert_blockvisibility_to_visibility",
"(",
"vis",
":",
"BlockVisibility",
")",
"->",
"Visibility",
":",
"assert",
"isinstance",
"(",
"vis",
",",
"BlockVisibility",
")",
",",
"\"vis is not a BlockVisibility: %r\"",
"%",
"vis",
"cvis",
",",
"cuvw",
",",
"cwt... | Convert the BlockVisibility data with no coalescence | [
"Convert",
"the",
"BlockVisibility",
"data",
"with",
"no",
"coalescence"
] | [
"\"\"\" Convert the BlockVisibility data with no coalescence\n\n :param vis: BlockVisibility to be converted\n :return: Visibility with cindex and blockvis filled in\n \"\"\""
] | [
{
"param": "vis",
"type": "BlockVisibility"
}
] | {
"returns": [
{
"docstring": "Visibility with cindex and blockvis filled in",
"docstring_tokens": [
"Visibility",
"with",
"cindex",
"and",
"blockvis",
"filled",
"in"
],
"type": null
}
],
"raises": [],
"params": [
{
... |
2c5d97b4d01a5f4a0cd89f9d88cd3598677f6907 | ska-telescope/algorithm-reference-library | processing_components/visibility/coalesce.py | [
"Apache-2.0"
] | Python | decoalesce_visibility | BlockVisibility | def decoalesce_visibility(vis: Visibility, **kwargs) -> BlockVisibility:
""" Decoalesce the visibilities to the original values (opposite of coalesce_visibility)
This relies upon the block vis and the index being part of the vis. Needs the index generated by coalesce_visibility
:param vis: (Coalesced visi... | Decoalesce the visibilities to the original values (opposite of coalesce_visibility)
This relies upon the block vis and the index being part of the vis. Needs the index generated by coalesce_visibility
:param vis: (Coalesced visibility)
:return: BlockVisibility with vis and weight columns overwritten
... | Decoalesce the visibilities to the original values (opposite of coalesce_visibility)
This relies upon the block vis and the index being part of the vis. Needs the index generated by coalesce_visibility | [
"Decoalesce",
"the",
"visibilities",
"to",
"the",
"original",
"values",
"(",
"opposite",
"of",
"coalesce_visibility",
")",
"This",
"relies",
"upon",
"the",
"block",
"vis",
"and",
"the",
"index",
"being",
"part",
"of",
"the",
"vis",
".",
"Needs",
"the",
"inde... | def decoalesce_visibility(vis: Visibility, **kwargs) -> BlockVisibility:
assert isinstance(vis, Visibility), "vis is not a Visibility: %r" % vis
assert isinstance(vis.blockvis, BlockVisibility), "No blockvisibility in vis %r" % vis
assert vis.cindex is not None, "No reverse index in Visibility %r" % vis
... | [
"def",
"decoalesce_visibility",
"(",
"vis",
":",
"Visibility",
",",
"**",
"kwargs",
")",
"->",
"BlockVisibility",
":",
"assert",
"isinstance",
"(",
"vis",
",",
"Visibility",
")",
",",
"\"vis is not a Visibility: %r\"",
"%",
"vis",
"assert",
"isinstance",
"(",
"v... | Decoalesce the visibilities to the original values (opposite of coalesce_visibility)
This relies upon the block vis and the index being part of the vis. | [
"Decoalesce",
"the",
"visibilities",
"to",
"the",
"original",
"values",
"(",
"opposite",
"of",
"coalesce_visibility",
")",
"This",
"relies",
"upon",
"the",
"block",
"vis",
"and",
"the",
"index",
"being",
"part",
"of",
"the",
"vis",
"."
] | [
"\"\"\" Decoalesce the visibilities to the original values (opposite of coalesce_visibility)\n\n This relies upon the block vis and the index being part of the vis. Needs the index generated by coalesce_visibility\n\n :param vis: (Coalesced visibility)\n :return: BlockVisibility with vis and weight columns... | [
{
"param": "vis",
"type": "Visibility"
}
] | {
"returns": [
{
"docstring": "BlockVisibility with vis and weight columns overwritten",
"docstring_tokens": [
"BlockVisibility",
"with",
"vis",
"and",
"weight",
"columns",
"overwritten"
],
"type": null
}
],
"raises": [],
"p... |
2c5d97b4d01a5f4a0cd89f9d88cd3598677f6907 | ska-telescope/algorithm-reference-library | processing_components/visibility/coalesce.py | [
"Apache-2.0"
] | Python | convert_visibility_to_blockvisibility | BlockVisibility | def convert_visibility_to_blockvisibility(vis: Visibility) -> BlockVisibility:
""" Convert a Visibility to equivalent BlockVisibility format
:param vis: Coalesced visibility
:return: Visibility
"""
if isinstance(vis, BlockVisibility):
return vis
else:
return decoalesce_visibilit... | Convert a Visibility to equivalent BlockVisibility format
:param vis: Coalesced visibility
:return: Visibility
| Convert a Visibility to equivalent BlockVisibility format | [
"Convert",
"a",
"Visibility",
"to",
"equivalent",
"BlockVisibility",
"format"
] | def convert_visibility_to_blockvisibility(vis: Visibility) -> BlockVisibility:
if isinstance(vis, BlockVisibility):
return vis
else:
return decoalesce_visibility(vis) | [
"def",
"convert_visibility_to_blockvisibility",
"(",
"vis",
":",
"Visibility",
")",
"->",
"BlockVisibility",
":",
"if",
"isinstance",
"(",
"vis",
",",
"BlockVisibility",
")",
":",
"return",
"vis",
"else",
":",
"return",
"decoalesce_visibility",
"(",
"vis",
")"
] | Convert a Visibility to equivalent BlockVisibility format | [
"Convert",
"a",
"Visibility",
"to",
"equivalent",
"BlockVisibility",
"format"
] | [
"\"\"\" Convert a Visibility to equivalent BlockVisibility format\n\n :param vis: Coalesced visibility\n :return: Visibility\n \"\"\""
] | [
{
"param": "vis",
"type": "Visibility"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis",
"type": "Visibility",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,... |
fc4b0760aa7e1618f35a9d9ca0d4766be0600fdb | ska-telescope/algorithm-reference-library | workflows/arlexecute/image/image_arlexecute.py | [
"Apache-2.0"
] | Python | image_arlexecute_map_workflow | <not_specific> | def image_arlexecute_map_workflow(im, imfunction, facets=1, overlap=0, taper=None, **kwargs):
"""Apply a function across an image: scattering to subimages, applying the function, and then gathering
:param im: Image to be processed
:param imfunction: Function to be applied
:param facets: See image_s... | Apply a function across an image: scattering to subimages, applying the function, and then gathering
:param im: Image to be processed
:param imfunction: Function to be applied
:param facets: See image_scatter_facets
:param overlap: image_scatter_facets
:param taper: image_scatter_facets
:pa... | Apply a function across an image: scattering to subimages, applying the function, and then gathering | [
"Apply",
"a",
"function",
"across",
"an",
"image",
":",
"scattering",
"to",
"subimages",
"applying",
"the",
"function",
"and",
"then",
"gathering"
] | def image_arlexecute_map_workflow(im, imfunction, facets=1, overlap=0, taper=None, **kwargs):
facets_list = arlexecute.execute(image_scatter_facets, nout=facets**2)(im, facets=facets, overlap=overlap,
taper=taper)
root_list = [arlexecute.execut... | [
"def",
"image_arlexecute_map_workflow",
"(",
"im",
",",
"imfunction",
",",
"facets",
"=",
"1",
",",
"overlap",
"=",
"0",
",",
"taper",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"facets_list",
"=",
"arlexecute",
".",
"execute",
"(",
"image_scatter_facets",
... | Apply a function across an image: scattering to subimages, applying the function, and then gathering | [
"Apply",
"a",
"function",
"across",
"an",
"image",
":",
"scattering",
"to",
"subimages",
"applying",
"the",
"function",
"and",
"then",
"gathering"
] | [
"\"\"\"Apply a function across an image: scattering to subimages, applying the function, and then gathering\n \n :param im: Image to be processed\n :param imfunction: Function to be applied\n :param facets: See image_scatter_facets\n :param overlap: image_scatter_facets\n :param taper: image_scatt... | [
{
"param": "im",
"type": null
},
{
"param": "imfunction",
"type": null
},
{
"param": "facets",
"type": null
},
{
"param": "overlap",
"type": null
},
{
"param": "taper",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "im",
"type": null,
"docstring": "Image to be processed",
"docstring_tokens": [
"Image",
"to",
... |
d60d032352acccb898d6460062164a2ea242f437 | ska-telescope/algorithm-reference-library | workflows/serial/simulation/simulation_serial.py | [
"Apache-2.0"
] | Python | simulate_list_serial_workflow | <not_specific> | def simulate_list_serial_workflow(config='LOWBD2',
phasecentre=SkyCoord(ra=+15.0 * u.deg, dec=-60.0 * u.deg, frame='icrs', equinox='J2000'),
frequency=None, channel_bandwidth=None, times=None,
polarisation_... | A component to simulate an observation
The simulation step can generate a single BlockVisibility or a list of BlockVisibility's.
The parameter keyword determines the way that the list is constructed.
If order='frequency' then len(frequency) BlockVisibility's with all times are created.
If order='time'... | A component to simulate an observation
The simulation step can generate a single BlockVisibility or a list of BlockVisibility's.
The parameter keyword determines the way that the list is constructed.
If order='frequency' then len(frequency) BlockVisibility's with all times are created.
If order='time' then len(times) ... | [
"A",
"component",
"to",
"simulate",
"an",
"observation",
"The",
"simulation",
"step",
"can",
"generate",
"a",
"single",
"BlockVisibility",
"or",
"a",
"list",
"of",
"BlockVisibility",
"'",
"s",
".",
"The",
"parameter",
"keyword",
"determines",
"the",
"way",
"th... | def simulate_list_serial_workflow(config='LOWBD2',
phasecentre=SkyCoord(ra=+15.0 * u.deg, dec=-60.0 * u.deg, frame='icrs', equinox='J2000'),
frequency=None, channel_bandwidth=None, times=None,
polarisation_... | [
"def",
"simulate_list_serial_workflow",
"(",
"config",
"=",
"'LOWBD2'",
",",
"phasecentre",
"=",
"SkyCoord",
"(",
"ra",
"=",
"+",
"15.0",
"*",
"u",
".",
"deg",
",",
"dec",
"=",
"-",
"60.0",
"*",
"u",
".",
"deg",
",",
"frame",
"=",
"'icrs'",
",",
"equ... | A component to simulate an observation
The simulation step can generate a single BlockVisibility or a list of BlockVisibility's. | [
"A",
"component",
"to",
"simulate",
"an",
"observation",
"The",
"simulation",
"step",
"can",
"generate",
"a",
"single",
"BlockVisibility",
"or",
"a",
"list",
"of",
"BlockVisibility",
"'",
"s",
"."
] | [
"\"\"\" A component to simulate an observation\n\n The simulation step can generate a single BlockVisibility or a list of BlockVisibility's.\n The parameter keyword determines the way that the list is constructed.\n If order='frequency' then len(frequency) BlockVisibility's with all times are created.\n ... | [
{
"param": "config",
"type": null
},
{
"param": "phasecentre",
"type": null
},
{
"param": "frequency",
"type": null
},
{
"param": "channel_bandwidth",
"type": null
},
{
"param": "times",
"type": null
},
{
"param": "polarisation_frame",
"type": null... | {
"returns": [
{
"docstring": "vis_list with different frequencies in different elements",
"docstring_tokens": [
"vis_list",
"with",
"different",
"frequencies",
"in",
"different",
"elements"
],
"type": null
}
],
"raises": [],
... |
d60d032352acccb898d6460062164a2ea242f437 | ska-telescope/algorithm-reference-library | workflows/serial/simulation/simulation_serial.py | [
"Apache-2.0"
] | Python | corrupt_list_serial_workflow | <not_specific> | def corrupt_list_serial_workflow(vis_list, gt_list=None, seed=None, **kwargs):
""" Create a graph to apply gain errors to a vis_list
:param vis_list:
:param gt_list: Optional gain table graph
:param kwargs:
:return:
"""
def corrupt_vis(vis, gt, **kwargs):
if isinstance(vis, Vis... | Create a graph to apply gain errors to a vis_list
:param vis_list:
:param gt_list: Optional gain table graph
:param kwargs:
:return:
| Create a graph to apply gain errors to a vis_list | [
"Create",
"a",
"graph",
"to",
"apply",
"gain",
"errors",
"to",
"a",
"vis_list"
] | def corrupt_list_serial_workflow(vis_list, gt_list=None, seed=None, **kwargs):
def corrupt_vis(vis, gt, **kwargs):
if isinstance(vis, Visibility):
bv = convert_visibility_to_blockvisibility(vis)
else:
bv = vis
if gt is None:
gt = create_gaintable_from_bloc... | [
"def",
"corrupt_list_serial_workflow",
"(",
"vis_list",
",",
"gt_list",
"=",
"None",
",",
"seed",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"def",
"corrupt_vis",
"(",
"vis",
",",
"gt",
",",
"**",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"vis",
",... | Create a graph to apply gain errors to a vis_list | [
"Create",
"a",
"graph",
"to",
"apply",
"gain",
"errors",
"to",
"a",
"vis_list"
] | [
"\"\"\" Create a graph to apply gain errors to a vis_list\n\n :param vis_list:\n :param gt_list: Optional gain table graph\n :param kwargs:\n :return:\n \"\"\""
] | [
{
"param": "vis_list",
"type": null
},
{
"param": "gt_list",
"type": null
},
{
"param": "seed",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
60cf79ed278b449111e7c8d0375989af02463dc6 | ska-telescope/algorithm-reference-library | processing_library/fourier_transforms/fft_support.py | [
"Apache-2.0"
] | Python | fft | <not_specific> | def fft(a):
""" Fourier transformation from image to grid space
.. note::
If there are four axes then the last outer axes are not transformed
:param a: image in `lm` coordinate space
:return: `uv` grid
"""
if pyfftw_exists == False:
if (len(a.shape) == 4):
... | Fourier transformation from image to grid space
.. note::
If there are four axes then the last outer axes are not transformed
:param a: image in `lm` coordinate space
:return: `uv` grid
| Fourier transformation from image to grid space
note:.
If there are four axes then the last outer axes are not transformed | [
"Fourier",
"transformation",
"from",
"image",
"to",
"grid",
"space",
"note",
":",
".",
"If",
"there",
"are",
"four",
"axes",
"then",
"the",
"last",
"outer",
"axes",
"are",
"not",
"transformed"
] | def fft(a):
if pyfftw_exists == False:
if (len(a.shape) == 4):
return numpy.fft.fftshift(numpy.fft.fft2(numpy.fft.ifftshift(a, axes=[2, 3])), axes=[2, 3])
if (len(a.shape) == 5):
return numpy.fft.fftshift(numpy.fft.fft2(numpy.fft.ifftshift(a, axes=[3, 4])), axes=[3, 4])
... | [
"def",
"fft",
"(",
"a",
")",
":",
"if",
"pyfftw_exists",
"==",
"False",
":",
"if",
"(",
"len",
"(",
"a",
".",
"shape",
")",
"==",
"4",
")",
":",
"return",
"numpy",
".",
"fft",
".",
"fftshift",
"(",
"numpy",
".",
"fft",
".",
"fft2",
"(",
"numpy"... | Fourier transformation from image to grid space
.. note:: | [
"Fourier",
"transformation",
"from",
"image",
"to",
"grid",
"space",
"..",
"note",
"::"
] | [
"\"\"\" Fourier transformation from image to grid space\n \n .. note::\n \n If there are four axes then the last outer axes are not transformed\n\n :param a: image in `lm` coordinate space\n :return: `uv` grid\n \"\"\""
] | [
{
"param": "a",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "a",
"type": null,
"docstring": "image in `lm` coordinate space",
"docstring_tokens": [
"image",
"in... |
60cf79ed278b449111e7c8d0375989af02463dc6 | ska-telescope/algorithm-reference-library | processing_library/fourier_transforms/fft_support.py | [
"Apache-2.0"
] | Python | ifft | <not_specific> | def ifft(a):
""" Fourier transformation from grid to image space
.. note::
If there are four axes then the last outer axes are not transformed
:param a: `uv` grid to transform
:return: an image in `lm` coordinate space
"""
if pyfftw_exists == False:
if (len(a.shape) == 4):... | Fourier transformation from grid to image space
.. note::
If there are four axes then the last outer axes are not transformed
:param a: `uv` grid to transform
:return: an image in `lm` coordinate space
| Fourier transformation from grid to image space
note:.
If there are four axes then the last outer axes are not transformed | [
"Fourier",
"transformation",
"from",
"grid",
"to",
"image",
"space",
"note",
":",
".",
"If",
"there",
"are",
"four",
"axes",
"then",
"the",
"last",
"outer",
"axes",
"are",
"not",
"transformed"
] | def ifft(a):
if pyfftw_exists == False:
if (len(a.shape) == 4):
return numpy.fft.fftshift(numpy.fft.ifft2(numpy.fft.ifftshift(a, axes=[2, 3])), axes=[2, 3])
elif (len(a.shape) == 5):
return numpy.fft.fftshift(numpy.fft.ifft2(numpy.fft.ifftshift(a, axes=[2, 3, 4])), axes=[2, 3... | [
"def",
"ifft",
"(",
"a",
")",
":",
"if",
"pyfftw_exists",
"==",
"False",
":",
"if",
"(",
"len",
"(",
"a",
".",
"shape",
")",
"==",
"4",
")",
":",
"return",
"numpy",
".",
"fft",
".",
"fftshift",
"(",
"numpy",
".",
"fft",
".",
"ifft2",
"(",
"nump... | Fourier transformation from grid to image space
.. note:: | [
"Fourier",
"transformation",
"from",
"grid",
"to",
"image",
"space",
"..",
"note",
"::"
] | [
"\"\"\" Fourier transformation from grid to image space\n\n .. note::\n \n If there are four axes then the last outer axes are not transformed\n\n :param a: `uv` grid to transform\n :return: an image in `lm` coordinate space\n \"\"\"",
"# a = pyfftw.byte_align(a)"
] | [
{
"param": "a",
"type": null
}
] | {
"returns": [
{
"docstring": "an image in `lm` coordinate space",
"docstring_tokens": [
"an",
"image",
"in",
"`",
"lm",
"`",
"coordinate",
"space"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifi... |
60cf79ed278b449111e7c8d0375989af02463dc6 | ska-telescope/algorithm-reference-library | processing_library/fourier_transforms/fft_support.py | [
"Apache-2.0"
] | Python | pad_mid | <not_specific> | def pad_mid(ff, npixel):
"""
Pad a far field image with zeroes to make it the given size.
Effectively as if we were multiplying with a box function of the
original field's size, which is equivalent to a convolution with a
sinc pattern in the uv-grid.
.. note::
Only the two innermo... |
Pad a far field image with zeroes to make it the given size.
Effectively as if we were multiplying with a box function of the
original field's size, which is equivalent to a convolution with a
sinc pattern in the uv-grid.
.. note::
Only the two innermost axes are transformed
... | Pad a far field image with zeroes to make it the given size.
Effectively as if we were multiplying with a box function of the
original field's size, which is equivalent to a convolution with a
sinc pattern in the uv-grid.
Only the two innermost axes are transformed
This function does not handle odd-sized dimensions... | [
"Pad",
"a",
"far",
"field",
"image",
"with",
"zeroes",
"to",
"make",
"it",
"the",
"given",
"size",
".",
"Effectively",
"as",
"if",
"we",
"were",
"multiplying",
"with",
"a",
"box",
"function",
"of",
"the",
"original",
"field",
"'",
"s",
"size",
"which",
... | def pad_mid(ff, npixel):
ny, nx = ff.shape[-2:]
cx = nx // 2
cy = ny // 2
if npixel == nx:
return ff
assert npixel > nx and npixel > ny
pw = [(0, 0)] * (ff.ndim - 2) + [(npixel // 2 - cy, npixel // 2 - cy),
(npixel // 2 - cx, npixel // 2 - cx)]
re... | [
"def",
"pad_mid",
"(",
"ff",
",",
"npixel",
")",
":",
"ny",
",",
"nx",
"=",
"ff",
".",
"shape",
"[",
"-",
"2",
":",
"]",
"cx",
"=",
"nx",
"//",
"2",
"cy",
"=",
"ny",
"//",
"2",
"if",
"npixel",
"==",
"nx",
":",
"return",
"ff",
"assert",
"npi... | Pad a far field image with zeroes to make it the given size. | [
"Pad",
"a",
"far",
"field",
"image",
"with",
"zeroes",
"to",
"make",
"it",
"the",
"given",
"size",
"."
] | [
"\"\"\"\n Pad a far field image with zeroes to make it the given size.\n\n Effectively as if we were multiplying with a box function of the\n original field's size, which is equivalent to a convolution with a\n sinc pattern in the uv-grid.\n\n .. note::\n \n Only the two innermost axes are ... | [
{
"param": "ff",
"type": null
},
{
"param": "npixel",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ff",
"type": null,
"docstring": "The input far field. Should be smaller than npixelxnpixel.",
"docstring_tokens": [
"The",
"input",
"far",
"field",
".",
"Should",
"be",
... |
60cf79ed278b449111e7c8d0375989af02463dc6 | ska-telescope/algorithm-reference-library | processing_library/fourier_transforms/fft_support.py | [
"Apache-2.0"
] | Python | extract_mid | <not_specific> | def extract_mid(a, npixel):
"""
Extract a section from middle of a map
Suitable for zero frequencies at npixel/2. This is the reverse
operation to pad.
.. note::
Only the two innermost axes are transformed
:param npixel: desired size of the section to extract
:param a: grid f... |
Extract a section from middle of a map
Suitable for zero frequencies at npixel/2. This is the reverse
operation to pad.
.. note::
Only the two innermost axes are transformed
:param npixel: desired size of the section to extract
:param a: grid from which to extract
| Extract a section from middle of a map
Suitable for zero frequencies at npixel/2. This is the reverse
operation to pad.
Only the two innermost axes are transformed | [
"Extract",
"a",
"section",
"from",
"middle",
"of",
"a",
"map",
"Suitable",
"for",
"zero",
"frequencies",
"at",
"npixel",
"/",
"2",
".",
"This",
"is",
"the",
"reverse",
"operation",
"to",
"pad",
".",
"Only",
"the",
"two",
"innermost",
"axes",
"are",
"tran... | def extract_mid(a, npixel):
ny, nx = a.shape[-2:]
cx = nx // 2
cy = ny // 2
s = npixel // 2
if npixel % 2 != 0:
return a[..., cx - s:cx + s + 1, cy - s:cy + s + 1]
else:
return a[..., cx - s:cx + s, cy - s:cy + s] | [
"def",
"extract_mid",
"(",
"a",
",",
"npixel",
")",
":",
"ny",
",",
"nx",
"=",
"a",
".",
"shape",
"[",
"-",
"2",
":",
"]",
"cx",
"=",
"nx",
"//",
"2",
"cy",
"=",
"ny",
"//",
"2",
"s",
"=",
"npixel",
"//",
"2",
"if",
"npixel",
"%",
"2",
"!... | Extract a section from middle of a map
Suitable for zero frequencies at npixel/2. | [
"Extract",
"a",
"section",
"from",
"middle",
"of",
"a",
"map",
"Suitable",
"for",
"zero",
"frequencies",
"at",
"npixel",
"/",
"2",
"."
] | [
"\"\"\"\n Extract a section from middle of a map\n\n Suitable for zero frequencies at npixel/2. This is the reverse\n operation to pad.\n\n .. note::\n \n Only the two innermost axes are transformed\n\n :param npixel: desired size of the section to extract\n :param a: grid from which to ... | [
{
"param": "a",
"type": null
},
{
"param": "npixel",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a",
"type": null,
"docstring": "grid from which to extract",
"docstring_tokens": [
"grid",
"from",
"which",
"to",
"extract"
],
"default": null,
"is_optional": null
... |
60cf79ed278b449111e7c8d0375989af02463dc6 | ska-telescope/algorithm-reference-library | processing_library/fourier_transforms/fft_support.py | [
"Apache-2.0"
] | Python | extract_oversampled | <not_specific> | def extract_oversampled(a, xf, yf, kernel_oversampling, kernelwidth):
"""
Extract the (xf-th,yf-th) w-kernel from the oversampled parent
Offsets are suitable for correcting of fractional coordinates,
e.g. an offset of (xf,yf) results in the kernel for an (-xf,-yf)
sub-grid offset.
We do not wa... |
Extract the (xf-th,yf-th) w-kernel from the oversampled parent
Offsets are suitable for correcting of fractional coordinates,
e.g. an offset of (xf,yf) results in the kernel for an (-xf,-yf)
sub-grid offset.
We do not want to make assumptions about the source grid's symmetry
here, which means... | Extract the (xf-th,yf-th) w-kernel from the oversampled parent
Offsets are suitable for correcting of fractional coordinates,
e.g. an offset of (xf,yf) results in the kernel for an (-xf,-yf)
sub-grid offset.
We do not want to make assumptions about the source grid's symmetry
here, which means that the grid's side leng... | [
"Extract",
"the",
"(",
"xf",
"-",
"th",
"yf",
"-",
"th",
")",
"w",
"-",
"kernel",
"from",
"the",
"oversampled",
"parent",
"Offsets",
"are",
"suitable",
"for",
"correcting",
"of",
"fractional",
"coordinates",
"e",
".",
"g",
".",
"an",
"offset",
"of",
"(... | def extract_oversampled(a, xf, yf, kernel_oversampling, kernelwidth):
assert 0 <= xf < kernel_oversampling
assert 0 <= yf < kernel_oversampling
npixela = a.shape[0]
my = npixela // 2 - kernel_oversampling * (kernelwidth // 2) - yf
mx = npixela // 2 - kernel_oversampling * (kernelwidth // 2) - xf
... | [
"def",
"extract_oversampled",
"(",
"a",
",",
"xf",
",",
"yf",
",",
"kernel_oversampling",
",",
"kernelwidth",
")",
":",
"assert",
"0",
"<=",
"xf",
"<",
"kernel_oversampling",
"assert",
"0",
"<=",
"yf",
"<",
"kernel_oversampling",
"npixela",
"=",
"a",
".",
... | Extract the (xf-th,yf-th) w-kernel from the oversampled parent
Offsets are suitable for correcting of fractional coordinates,
e.g. | [
"Extract",
"the",
"(",
"xf",
"-",
"th",
"yf",
"-",
"th",
")",
"w",
"-",
"kernel",
"from",
"the",
"oversampled",
"parent",
"Offsets",
"are",
"suitable",
"for",
"correcting",
"of",
"fractional",
"coordinates",
"e",
".",
"g",
"."
] | [
"\"\"\"\n Extract the (xf-th,yf-th) w-kernel from the oversampled parent\n\n Offsets are suitable for correcting of fractional coordinates,\n e.g. an offset of (xf,yf) results in the kernel for an (-xf,-yf)\n sub-grid offset.\n\n We do not want to make assumptions about the source grid's symmetry\n ... | [
{
"param": "a",
"type": null
},
{
"param": "xf",
"type": null
},
{
"param": "yf",
"type": null
},
{
"param": "kernel_oversampling",
"type": null
},
{
"param": "kernelwidth",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a",
"type": null,
"docstring": "grid from which to extract",
"docstring_tokens": [
"grid",
"from",
"which",
"to",
"extract"
],
"default": null,
"is_optional": null
... |
13646a80c77b8d466903f3aa735bae326f44b10a | ska-telescope/algorithm-reference-library | workflows/arlexecute/imaging/imaging_arlexecute.py | [
"Apache-2.0"
] | Python | predict_list_arlexecute_workflow | <not_specific> | def predict_list_arlexecute_workflow(vis_list, model_imagelist, context, vis_slices=1, facets=1,
gcfcf=None, **kwargs):
"""Predict, iterating over both the scattered vis_list and image
The visibility and image are scattered, the visibility is predicted on each part, and... | Predict, iterating over both the scattered vis_list and image
The visibility and image are scattered, the visibility is predicted on each part, and then the
parts are assembled.
:param vis_list:
:param model_imagelist: Model used to determine image parameters
:param vis_slices: Number of vis s... | Predict, iterating over both the scattered vis_list and image
The visibility and image are scattered, the visibility is predicted on each part, and then the
parts are assembled. | [
"Predict",
"iterating",
"over",
"both",
"the",
"scattered",
"vis_list",
"and",
"image",
"The",
"visibility",
"and",
"image",
"are",
"scattered",
"the",
"visibility",
"is",
"predicted",
"on",
"each",
"part",
"and",
"then",
"the",
"parts",
"are",
"assembled",
".... | def predict_list_arlexecute_workflow(vis_list, model_imagelist, context, vis_slices=1, facets=1,
gcfcf=None, **kwargs):
if get_parameter(kwargs, "use_serial_predict", False):
from workflows.serial.imaging.imaging_serial import predict_list_serial_workflow
return ... | [
"def",
"predict_list_arlexecute_workflow",
"(",
"vis_list",
",",
"model_imagelist",
",",
"context",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"gcfcf",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"get_parameter",
"(",
"kwargs",
",",
"... | Predict, iterating over both the scattered vis_list and image
The visibility and image are scattered, the visibility is predicted on each part, and then the
parts are assembled. | [
"Predict",
"iterating",
"over",
"both",
"the",
"scattered",
"vis_list",
"and",
"image",
"The",
"visibility",
"and",
"image",
"are",
"scattered",
"the",
"visibility",
"is",
"predicted",
"on",
"each",
"part",
"and",
"then",
"the",
"parts",
"are",
"assembled",
".... | [
"\"\"\"Predict, iterating over both the scattered vis_list and image\n \n The visibility and image are scattered, the visibility is predicted on each part, and then the\n parts are assembled.\n\n :param vis_list:\n :param model_imagelist: Model used to determine image parameters\n :param vis_slice... | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type": null
},
{
"param": "gcfcf",
"type": null
}
] | {
"returns": [
{
"docstring": "List of vis_lists",
"docstring_tokens": [
"List",
"of",
"vis_lists"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens": [... |
13646a80c77b8d466903f3aa735bae326f44b10a | ska-telescope/algorithm-reference-library | workflows/arlexecute/imaging/imaging_arlexecute.py | [
"Apache-2.0"
] | Python | invert_list_arlexecute_workflow | <not_specific> | def invert_list_arlexecute_workflow(vis_list, template_model_imagelist, context, dopsf=False, normalize=True,
facets=1, vis_slices=1, gcfcf=None, **kwargs):
""" Sum results from invert, iterating over the scattered image and vis_list
:param vis_list:
:param template_mode... | Sum results from invert, iterating over the scattered image and vis_list
:param vis_list:
:param template_model_imagelist: Model used to determine image parameters
:param dopsf: Make the PSF instead of the dirty image
:param facets: Number of facets
:param normalize: Normalize by sumwt
:param ... | Sum results from invert, iterating over the scattered image and vis_list | [
"Sum",
"results",
"from",
"invert",
"iterating",
"over",
"the",
"scattered",
"image",
"and",
"vis_list"
] | def invert_list_arlexecute_workflow(vis_list, template_model_imagelist, context, dopsf=False, normalize=True,
facets=1, vis_slices=1, gcfcf=None, **kwargs):
if get_parameter(kwargs, "use_serial_invert", False):
from workflows.serial.imaging.imaging_serial import invert_li... | [
"def",
"invert_list_arlexecute_workflow",
"(",
"vis_list",
",",
"template_model_imagelist",
",",
"context",
",",
"dopsf",
"=",
"False",
",",
"normalize",
"=",
"True",
",",
"facets",
"=",
"1",
",",
"vis_slices",
"=",
"1",
",",
"gcfcf",
"=",
"None",
",",
"**",... | Sum results from invert, iterating over the scattered image and vis_list | [
"Sum",
"results",
"from",
"invert",
"iterating",
"over",
"the",
"scattered",
"image",
"and",
"vis_list"
] | [
"\"\"\" Sum results from invert, iterating over the scattered image and vis_list\n\n :param vis_list:\n :param template_model_imagelist: Model used to determine image parameters\n :param dopsf: Make the PSF instead of the dirty image\n :param facets: Number of facets\n :param normalize: Normalize by ... | [
{
"param": "vis_list",
"type": null
},
{
"param": "template_model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "dopsf",
"type": null
},
{
"param": "normalize",
"type": null
},
{
"param": "facets",
"type": null
},
... | {
"returns": [
{
"docstring": "List of (image, sumwt) tuple",
"docstring_tokens": [
"List",
"of",
"(",
"image",
"sumwt",
")",
"tuple"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
... |
13646a80c77b8d466903f3aa735bae326f44b10a | ska-telescope/algorithm-reference-library | workflows/arlexecute/imaging/imaging_arlexecute.py | [
"Apache-2.0"
] | Python | residual_list_arlexecute_workflow | <not_specific> | def residual_list_arlexecute_workflow(vis, model_imagelist, context='2d', gcfcf=None, **kwargs):
""" Create a graph to calculate residual image
:param vis:
:param model_imagelist: Model used to determine image parameters
:param context:
:param gcfcg: tuple containing grid correction and convolution ... | Create a graph to calculate residual image
:param vis:
:param model_imagelist: Model used to determine image parameters
:param context:
:param gcfcg: tuple containing grid correction and convolution function
:param kwargs: Parameters for functions in components
:return:
| Create a graph to calculate residual image | [
"Create",
"a",
"graph",
"to",
"calculate",
"residual",
"image"
] | def residual_list_arlexecute_workflow(vis, model_imagelist, context='2d', gcfcf=None, **kwargs):
model_vis = zero_list_arlexecute_workflow(vis)
model_vis = predict_list_arlexecute_workflow(model_vis, model_imagelist, context=context,
gcfcf=gcfcf, **kwargs)
re... | [
"def",
"residual_list_arlexecute_workflow",
"(",
"vis",
",",
"model_imagelist",
",",
"context",
"=",
"'2d'",
",",
"gcfcf",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"model_vis",
"=",
"zero_list_arlexecute_workflow",
"(",
"vis",
")",
"model_vis",
"=",
"predict_... | Create a graph to calculate residual image | [
"Create",
"a",
"graph",
"to",
"calculate",
"residual",
"image"
] | [
"\"\"\" Create a graph to calculate residual image\n :param vis:\n :param model_imagelist: Model used to determine image parameters\n :param context:\n :param gcfcg: tuple containing grid correction and convolution function\n :param kwargs: Parameters for functions in components\n :return:\n \"... | [
{
"param": "vis",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "gcfcf",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"... |
13646a80c77b8d466903f3aa735bae326f44b10a | ska-telescope/algorithm-reference-library | workflows/arlexecute/imaging/imaging_arlexecute.py | [
"Apache-2.0"
] | Python | restore_list_arlexecute_workflow | <not_specific> | def restore_list_arlexecute_workflow(model_imagelist, psf_imagelist, residual_imagelist=None, restore_facets=1,
restore_overlap=0, restore_taper='tukey', **kwargs):
""" Create a graph to calculate the restored image
:param model_imagelist: Model list
:param psf_imagelis... | Create a graph to calculate the restored image
:param model_imagelist: Model list
:param psf_imagelist: PSF list
:param residual_imagelist: Residual list
:param kwargs: Parameters for functions in components
:param restore_facets: Number of facets used per axis (used to distribute)
:param rest... | Create a graph to calculate the restored image | [
"Create",
"a",
"graph",
"to",
"calculate",
"the",
"restored",
"image"
] | def restore_list_arlexecute_workflow(model_imagelist, psf_imagelist, residual_imagelist=None, restore_facets=1,
restore_overlap=0, restore_taper='tukey', **kwargs):
assert len(model_imagelist) == len(psf_imagelist)
if residual_imagelist is not None:
assert len(model_... | [
"def",
"restore_list_arlexecute_workflow",
"(",
"model_imagelist",
",",
"psf_imagelist",
",",
"residual_imagelist",
"=",
"None",
",",
"restore_facets",
"=",
"1",
",",
"restore_overlap",
"=",
"0",
",",
"restore_taper",
"=",
"'tukey'",
",",
"**",
"kwargs",
")",
":",... | Create a graph to calculate the restored image | [
"Create",
"a",
"graph",
"to",
"calculate",
"the",
"restored",
"image"
] | [
"\"\"\" Create a graph to calculate the restored image\n\n :param model_imagelist: Model list\n :param psf_imagelist: PSF list\n :param residual_imagelist: Residual list\n :param kwargs: Parameters for functions in components\n :param restore_facets: Number of facets used per axis (used to distribute... | [
{
"param": "model_imagelist",
"type": null
},
{
"param": "psf_imagelist",
"type": null
},
{
"param": "residual_imagelist",
"type": null
},
{
"param": "restore_facets",
"type": null
},
{
"param": "restore_overlap",
"type": null
},
{
"param": "restore_ta... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "model_imagelist",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": n... |
13646a80c77b8d466903f3aa735bae326f44b10a | ska-telescope/algorithm-reference-library | workflows/arlexecute/imaging/imaging_arlexecute.py | [
"Apache-2.0"
] | Python | deconvolve_list_arlexecute_workflow | <not_specific> | def deconvolve_list_arlexecute_workflow(dirty_list, psf_list, model_imagelist, prefix='', mask=None, **kwargs):
"""Create a graph for deconvolution, adding to the model
:param dirty_list:
:param psf_list:
:param model_imagelist:
:param prefix: Informative prefix to log messages
:param mask: Mas... | Create a graph for deconvolution, adding to the model
:param dirty_list:
:param psf_list:
:param model_imagelist:
:param prefix: Informative prefix to log messages
:param mask: Mask for deconvolution
:param kwargs: Parameters for functions in components
:return: graph for the deconvolution
... | Create a graph for deconvolution, adding to the model | [
"Create",
"a",
"graph",
"for",
"deconvolution",
"adding",
"to",
"the",
"model"
] | def deconvolve_list_arlexecute_workflow(dirty_list, psf_list, model_imagelist, prefix='', mask=None, **kwargs):
nchan = len(dirty_list)
nmoment = get_parameter(kwargs, "nmoment", 1)
if get_parameter(kwargs, "use_serial_clean", False):
from workflows.serial.imaging.imaging_serial import deconvolve_li... | [
"def",
"deconvolve_list_arlexecute_workflow",
"(",
"dirty_list",
",",
"psf_list",
",",
"model_imagelist",
",",
"prefix",
"=",
"''",
",",
"mask",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"nchan",
"=",
"len",
"(",
"dirty_list",
")",
"nmoment",
"=",
"get_par... | Create a graph for deconvolution, adding to the model | [
"Create",
"a",
"graph",
"for",
"deconvolution",
"adding",
"to",
"the",
"model"
] | [
"\"\"\"Create a graph for deconvolution, adding to the model\n\n :param dirty_list:\n :param psf_list:\n :param model_imagelist:\n :param prefix: Informative prefix to log messages\n :param mask: Mask for deconvolution\n :param kwargs: Parameters for functions in components\n :return: graph for... | [
{
"param": "dirty_list",
"type": null
},
{
"param": "psf_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "prefix",
"type": null
},
{
"param": "mask",
"type": null
}
] | {
"returns": [
{
"docstring": "graph for the deconvolution",
"docstring_tokens": [
"graph",
"for",
"the",
"deconvolution"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dirty_list",
"type": null,
"docstring": ... |
13646a80c77b8d466903f3aa735bae326f44b10a | ska-telescope/algorithm-reference-library | workflows/arlexecute/imaging/imaging_arlexecute.py | [
"Apache-2.0"
] | Python | deconvolve_list_channel_arlexecute_workflow | <not_specific> | def deconvolve_list_channel_arlexecute_workflow(dirty_list, psf_list, model_imagelist, subimages, **kwargs):
"""Create a graph for deconvolution by channels, adding to the model
Does deconvolution channel by channel.
:param subimages:
:param dirty_list:
:param psf_list: Must be the size of a facet... | Create a graph for deconvolution by channels, adding to the model
Does deconvolution channel by channel.
:param subimages:
:param dirty_list:
:param psf_list: Must be the size of a facet
:param model_imagelist: Current model
:param kwargs: Parameters for functions in components
:return:
... | Create a graph for deconvolution by channels, adding to the model
Does deconvolution channel by channel. | [
"Create",
"a",
"graph",
"for",
"deconvolution",
"by",
"channels",
"adding",
"to",
"the",
"model",
"Does",
"deconvolution",
"channel",
"by",
"channel",
"."
] | def deconvolve_list_channel_arlexecute_workflow(dirty_list, psf_list, model_imagelist, subimages, **kwargs):
def deconvolve_subimage(dirty, psf):
assert isinstance(dirty, Image)
assert isinstance(psf, Image)
comp = deconvolve_cube(dirty, psf, **kwargs)
return comp[0]
def add_mode... | [
"def",
"deconvolve_list_channel_arlexecute_workflow",
"(",
"dirty_list",
",",
"psf_list",
",",
"model_imagelist",
",",
"subimages",
",",
"**",
"kwargs",
")",
":",
"def",
"deconvolve_subimage",
"(",
"dirty",
",",
"psf",
")",
":",
"assert",
"isinstance",
"(",
"dirty... | Create a graph for deconvolution by channels, adding to the model
Does deconvolution channel by channel. | [
"Create",
"a",
"graph",
"for",
"deconvolution",
"by",
"channels",
"adding",
"to",
"the",
"model",
"Does",
"deconvolution",
"channel",
"by",
"channel",
"."
] | [
"\"\"\"Create a graph for deconvolution by channels, adding to the model\n\n Does deconvolution channel by channel.\n :param subimages: \n :param dirty_list:\n :param psf_list: Must be the size of a facet\n :param model_imagelist: Current model\n :param kwargs: Parameters for functions in componen... | [
{
"param": "dirty_list",
"type": null
},
{
"param": "psf_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "subimages",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dirty_list",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
13646a80c77b8d466903f3aa735bae326f44b10a | ska-telescope/algorithm-reference-library | workflows/arlexecute/imaging/imaging_arlexecute.py | [
"Apache-2.0"
] | Python | weight_list_arlexecute_workflow | <not_specific> | def weight_list_arlexecute_workflow(vis_list, model_imagelist, gcfcf=None, weighting='uniform', **kwargs):
""" Weight the visibility data
This is done collectively so the weights are summed over all vis_lists and then
corrected
:param vis_list:
:param model_imagelist: Model required to determi... | Weight the visibility data
This is done collectively so the weights are summed over all vis_lists and then
corrected
:param vis_list:
:param model_imagelist: Model required to determine weighting parameters
:param weighting: Type of weighting
:param kwargs: Parameters for functions in gra... | Weight the visibility data
This is done collectively so the weights are summed over all vis_lists and then
corrected | [
"Weight",
"the",
"visibility",
"data",
"This",
"is",
"done",
"collectively",
"so",
"the",
"weights",
"are",
"summed",
"over",
"all",
"vis_lists",
"and",
"then",
"corrected"
] | def weight_list_arlexecute_workflow(vis_list, model_imagelist, gcfcf=None, weighting='uniform', **kwargs):
centre = len(model_imagelist) // 2
if gcfcf is None:
gcfcf = [arlexecute.execute(create_pswf_convolutionfunction)(model_imagelist[centre])]
def to_vis(v):
if isinstance(v, BlockVisibili... | [
"def",
"weight_list_arlexecute_workflow",
"(",
"vis_list",
",",
"model_imagelist",
",",
"gcfcf",
"=",
"None",
",",
"weighting",
"=",
"'uniform'",
",",
"**",
"kwargs",
")",
":",
"centre",
"=",
"len",
"(",
"model_imagelist",
")",
"//",
"2",
"if",
"gcfcf",
"is"... | Weight the visibility data
This is done collectively so the weights are summed over all vis_lists and then
corrected | [
"Weight",
"the",
"visibility",
"data",
"This",
"is",
"done",
"collectively",
"so",
"the",
"weights",
"are",
"summed",
"over",
"all",
"vis_lists",
"and",
"then",
"corrected"
] | [
"\"\"\" Weight the visibility data\n \n This is done collectively so the weights are summed over all vis_lists and then\n corrected\n\n :param vis_list:\n :param model_imagelist: Model required to determine weighting parameters\n :param weighting: Type of weighting\n :param kwargs: Parameters f... | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "gcfcf",
"type": null
},
{
"param": "weighting",
"type": null
}
] | {
"returns": [
{
"docstring": "List of vis_graphs",
"docstring_tokens": [
"List",
"of",
"vis_graphs"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens":... |
13646a80c77b8d466903f3aa735bae326f44b10a | ska-telescope/algorithm-reference-library | workflows/arlexecute/imaging/imaging_arlexecute.py | [
"Apache-2.0"
] | Python | zero_list_arlexecute_workflow | <not_specific> | def zero_list_arlexecute_workflow(vis_list):
""" Initialise vis to zero: creates new data holders
:param vis_list:
:return: List of vis_lists
"""
def zero(vis):
if vis is not None:
zerovis = copy_visibility(vis)
zerovis.data['vis'][...] = 0.0
return z... | Initialise vis to zero: creates new data holders
:param vis_list:
:return: List of vis_lists
| Initialise vis to zero: creates new data holders | [
"Initialise",
"vis",
"to",
"zero",
":",
"creates",
"new",
"data",
"holders"
] | def zero_list_arlexecute_workflow(vis_list):
def zero(vis):
if vis is not None:
zerovis = copy_visibility(vis)
zerovis.data['vis'][...] = 0.0
return zerovis
else:
return None
result = [arlexecute.execute(zero, pure=True, nout=1)(v) for v in vis_lis... | [
"def",
"zero_list_arlexecute_workflow",
"(",
"vis_list",
")",
":",
"def",
"zero",
"(",
"vis",
")",
":",
"if",
"vis",
"is",
"not",
"None",
":",
"zerovis",
"=",
"copy_visibility",
"(",
"vis",
")",
"zerovis",
".",
"data",
"[",
"'vis'",
"]",
"[",
"...",
"]... | Initialise vis to zero: creates new data holders | [
"Initialise",
"vis",
"to",
"zero",
":",
"creates",
"new",
"data",
"holders"
] | [
"\"\"\" Initialise vis to zero: creates new data holders\n\n :param vis_list:\n :return: List of vis_lists\n \"\"\""
] | [
{
"param": "vis_list",
"type": null
}
] | {
"returns": [
{
"docstring": "List of vis_lists",
"docstring_tokens": [
"List",
"of",
"vis_lists"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens": [... |
13646a80c77b8d466903f3aa735bae326f44b10a | ska-telescope/algorithm-reference-library | workflows/arlexecute/imaging/imaging_arlexecute.py | [
"Apache-2.0"
] | Python | sum_invert_results_arlexecute | <not_specific> | def sum_invert_results_arlexecute(image_list, split=2):
""" Sum a set of invert results with appropriate weighting
:param image_list: List of (image, sum weights) tuples
:param split: Split into
:return: image, sum of weights
"""
if len(image_list) > split:
centre = len(image_list) // s... | Sum a set of invert results with appropriate weighting
:param image_list: List of (image, sum weights) tuples
:param split: Split into
:return: image, sum of weights
| Sum a set of invert results with appropriate weighting | [
"Sum",
"a",
"set",
"of",
"invert",
"results",
"with",
"appropriate",
"weighting"
] | def sum_invert_results_arlexecute(image_list, split=2):
if len(image_list) > split:
centre = len(image_list) // split
result = [sum_invert_results_arlexecute(image_list[:centre])]
result.append(sum_invert_results_arlexecute(image_list[centre:]))
return arlexecute.execute(sum_invert_r... | [
"def",
"sum_invert_results_arlexecute",
"(",
"image_list",
",",
"split",
"=",
"2",
")",
":",
"if",
"len",
"(",
"image_list",
")",
">",
"split",
":",
"centre",
"=",
"len",
"(",
"image_list",
")",
"//",
"split",
"result",
"=",
"[",
"sum_invert_results_arlexecu... | Sum a set of invert results with appropriate weighting | [
"Sum",
"a",
"set",
"of",
"invert",
"results",
"with",
"appropriate",
"weighting"
] | [
"\"\"\" Sum a set of invert results with appropriate weighting\n\n :param image_list: List of (image, sum weights) tuples\n :param split: Split into\n :return: image, sum of weights\n \"\"\""
] | [
{
"param": "image_list",
"type": null
},
{
"param": "split",
"type": null
}
] | {
"returns": [
{
"docstring": "image, sum of weights",
"docstring_tokens": [
"image",
"sum",
"of",
"weights"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "image_list",
"type": null,
"docstring": "List of (ima... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | hogbom_complex | <not_specific> | def hogbom_complex(dirty_q, dirty_u, psf_q, psf_u, window, gain, thresh, niter, fracthresh):
"""Clean the point spread function from a dirty Q+iU image
This uses the complex Hogbom CLEAN for polarised data (2016MNRAS.462.3483P)
The starting-point for the code was the standard Hogbom clean algorithm availa... | Clean the point spread function from a dirty Q+iU image
This uses the complex Hogbom CLEAN for polarised data (2016MNRAS.462.3483P)
The starting-point for the code was the standard Hogbom clean algorithm available in ARL.
Args:
dirty_q (numpy array): The dirty Q Image, i.e., the Q Image to be deconvo... | Clean the point spread function from a dirty Q+iU image
This uses the complex Hogbom CLEAN for polarised data (2016MNRAS.462.3483P)
The starting-point for the code was the standard Hogbom clean algorithm available in ARL.
dirty_q (numpy array): The dirty Q Image, i.e., the Q Image to be deconvolved.
dirty_u (numpy ar... | [
"Clean",
"the",
"point",
"spread",
"function",
"from",
"a",
"dirty",
"Q",
"+",
"iU",
"image",
"This",
"uses",
"the",
"complex",
"Hogbom",
"CLEAN",
"for",
"polarised",
"data",
"(",
"2016MNRAS",
".",
"462",
".",
"3483P",
")",
"The",
"starting",
"-",
"point... | def hogbom_complex(dirty_q, dirty_u, psf_q, psf_u, window, gain, thresh, niter, fracthresh):
assert 0.0 < gain < 2.0
assert niter > 0
dirty_complex = dirty_q + 1j * dirty_u
log.info("hogbom_mod: Max abs in dirty image = %.6f" % numpy.max(numpy.abs(dirty_complex)))
absolutethresh = max(thresh, fracth... | [
"def",
"hogbom_complex",
"(",
"dirty_q",
",",
"dirty_u",
",",
"psf_q",
",",
"psf_u",
",",
"window",
",",
"gain",
",",
"thresh",
",",
"niter",
",",
"fracthresh",
")",
":",
"assert",
"0.0",
"<",
"gain",
"<",
"2.0",
"assert",
"niter",
">",
"0",
"dirty_com... | Clean the point spread function from a dirty Q+iU image
This uses the complex Hogbom CLEAN for polarised data (2016MNRAS.462.3483P) | [
"Clean",
"the",
"point",
"spread",
"function",
"from",
"a",
"dirty",
"Q",
"+",
"iU",
"image",
"This",
"uses",
"the",
"complex",
"Hogbom",
"CLEAN",
"for",
"polarised",
"data",
"(",
"2016MNRAS",
".",
"462",
".",
"3483P",
")"
] | [
"\"\"\"Clean the point spread function from a dirty Q+iU image\n\n This uses the complex Hogbom CLEAN for polarised data (2016MNRAS.462.3483P)\n\n The starting-point for the code was the standard Hogbom clean algorithm available in ARL.\n\n Args:\n dirty_q (numpy array): The dirty Q Image, i.e., the Q I... | [
{
"param": "dirty_q",
"type": null
},
{
"param": "dirty_u",
"type": null
},
{
"param": "psf_q",
"type": null
},
{
"param": "psf_u",
"type": null
},
{
"param": "window",
"type": null
},
{
"param": "gain",
"type": null
},
{
"param": "thresh",... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dirty_q",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dirty_u",
"type": null,
"docstring": null,
"docstring_toke... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | msclean | <not_specific> | def msclean(dirty, psf, window, gain, thresh, niter, scales, fracthresh, prefix=''):
""" Perform multiscale clean
Multiscale CLEAN (IEEE Journal of Selected Topics in Sig Proc, 2008 vol. 2 pp. 793-801)
This version operates on numpy arrays.
:param prefix:
:param fracthresh:
:param dirty: The ... | Perform multiscale clean
Multiscale CLEAN (IEEE Journal of Selected Topics in Sig Proc, 2008 vol. 2 pp. 793-801)
This version operates on numpy arrays.
:param prefix:
:param fracthresh:
:param dirty: The dirty image, i.e., the image to be deconvolved
:param psf: The point spread-function
... | Perform multiscale clean
Multiscale CLEAN
This version operates on numpy arrays. | [
"Perform",
"multiscale",
"clean",
"Multiscale",
"CLEAN",
"This",
"version",
"operates",
"on",
"numpy",
"arrays",
"."
] | def msclean(dirty, psf, window, gain, thresh, niter, scales, fracthresh, prefix=''):
starttime = time.time()
assert 0.0 < gain < 2.0
assert niter > 0
assert len(scales) > 0
comps = numpy.zeros(dirty.shape)
pmax = psf.max()
assert pmax > 0.0
psfpeak = argmax(numpy.fabs(psf))
log.info(... | [
"def",
"msclean",
"(",
"dirty",
",",
"psf",
",",
"window",
",",
"gain",
",",
"thresh",
",",
"niter",
",",
"scales",
",",
"fracthresh",
",",
"prefix",
"=",
"''",
")",
":",
"starttime",
"=",
"time",
".",
"time",
"(",
")",
"assert",
"0.0",
"<",
"gain"... | Perform multiscale clean
Multiscale CLEAN (IEEE Journal of Selected Topics in Sig Proc, 2008 vol. | [
"Perform",
"multiscale",
"clean",
"Multiscale",
"CLEAN",
"(",
"IEEE",
"Journal",
"of",
"Selected",
"Topics",
"in",
"Sig",
"Proc",
"2008",
"vol",
"."
] | [
"\"\"\" Perform multiscale clean\n\n Multiscale CLEAN (IEEE Journal of Selected Topics in Sig Proc, 2008 vol. 2 pp. 793-801)\n\n This version operates on numpy arrays.\n\n :param prefix:\n :param fracthresh:\n :param dirty: The dirty image, i.e., the image to be deconvolved\n :param psf: The point... | [
{
"param": "dirty",
"type": null
},
{
"param": "psf",
"type": null
},
{
"param": "window",
"type": null
},
{
"param": "gain",
"type": null
},
{
"param": "thresh",
"type": null
},
{
"param": "niter",
"type": null
},
{
"param": "scales",
... | {
"returns": [
{
"docstring": "clean component image, residual image",
"docstring_tokens": [
"clean",
"component",
"image",
"residual",
"image"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dirty",
"type": ... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | create_scalestack | <not_specific> | def create_scalestack(scaleshape, scales, norm=True):
""" Create a cube consisting of the scales
:param scaleshape: desired shape of stack
:param scales: scales (in pixels)
:param norm: Normalise each plane to unity?
:return: stack
"""
assert scaleshape[0] == len(scales)
basis = numpy.... | Create a cube consisting of the scales
:param scaleshape: desired shape of stack
:param scales: scales (in pixels)
:param norm: Normalise each plane to unity?
:return: stack
| Create a cube consisting of the scales | [
"Create",
"a",
"cube",
"consisting",
"of",
"the",
"scales"
] | def create_scalestack(scaleshape, scales, norm=True):
assert scaleshape[0] == len(scales)
basis = numpy.zeros(scaleshape)
nx = scaleshape[1]
ny = scaleshape[2]
xcen = int(numpy.ceil(float(nx) / 2.0))
ycen = int(numpy.ceil(float(ny) / 2.0))
for iscale in numpy.arange(0, len(scales)):
... | [
"def",
"create_scalestack",
"(",
"scaleshape",
",",
"scales",
",",
"norm",
"=",
"True",
")",
":",
"assert",
"scaleshape",
"[",
"0",
"]",
"==",
"len",
"(",
"scales",
")",
"basis",
"=",
"numpy",
".",
"zeros",
"(",
"scaleshape",
")",
"nx",
"=",
"scaleshap... | Create a cube consisting of the scales | [
"Create",
"a",
"cube",
"consisting",
"of",
"the",
"scales"
] | [
"\"\"\" Create a cube consisting of the scales\n\n :param scaleshape: desired shape of stack\n :param scales: scales (in pixels)\n :param norm: Normalise each plane to unity?\n :return: stack\n \"\"\"",
"# Unroll this since spheroidal_function needs a scalar"
] | [
{
"param": "scaleshape",
"type": null
},
{
"param": "scales",
"type": null
},
{
"param": "norm",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "scaleshape",
"type": null,
"docstring": "desired shape of stack",
"docstring_tokens": [
"desired",
... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | find_max_abs_stack | <not_specific> | def find_max_abs_stack(stack, windowstack, couplingmatrix):
"""Find the location and value of the absolute maximum in this stack
:param stack: stack to be searched
:param windowstack: Window for the search
:param couplingmatrix: Coupling matrix between difference scales
:return: x, y, scale
"""... | Find the location and value of the absolute maximum in this stack
:param stack: stack to be searched
:param windowstack: Window for the search
:param couplingmatrix: Coupling matrix between difference scales
:return: x, y, scale
| Find the location and value of the absolute maximum in this stack | [
"Find",
"the",
"location",
"and",
"value",
"of",
"the",
"absolute",
"maximum",
"in",
"this",
"stack"
] | def find_max_abs_stack(stack, windowstack, couplingmatrix):
pabsmax = 0.0
pscale = 0
px = 0
py = 0
nscales = stack.shape[0]
assert nscales > 0
pshape = [stack.shape[1], stack.shape[2]]
for iscale in range(nscales):
if windowstack is not None:
resid = stack[iscale, :, ... | [
"def",
"find_max_abs_stack",
"(",
"stack",
",",
"windowstack",
",",
"couplingmatrix",
")",
":",
"pabsmax",
"=",
"0.0",
"pscale",
"=",
"0",
"px",
"=",
"0",
"py",
"=",
"0",
"nscales",
"=",
"stack",
".",
"shape",
"[",
"0",
"]",
"assert",
"nscales",
">",
... | Find the location and value of the absolute maximum in this stack | [
"Find",
"the",
"location",
"and",
"value",
"of",
"the",
"absolute",
"maximum",
"in",
"this",
"stack"
] | [
"\"\"\"Find the location and value of the absolute maximum in this stack\n :param stack: stack to be searched\n :param windowstack: Window for the search\n :param couplingmatrix: Coupling matrix between difference scales\n :return: x, y, scale\n\n \"\"\"",
"# Find the peak in the scaled residual im... | [
{
"param": "stack",
"type": null
},
{
"param": "windowstack",
"type": null
},
{
"param": "couplingmatrix",
"type": null
}
] | {
"returns": [
{
"docstring": "x, y, scale",
"docstring_tokens": [
"x",
"y",
"scale"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "stack",
"type": null,
"docstring": "stack to be searched",
"docstring_tokens": ... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | spheroidal_function | <not_specific> | def spheroidal_function(vnu):
""" Evaluates the PROLATE SPHEROIDAL WAVEFUNCTION
m=6, alpha = 1 from Schwab, Indirect Imaging (1984).
This is one factor in the basis function.
"""
# Code adapted Anna's f90 PROFILE (gridder.f90) code
# which was adapted from Tim Cornwell's C++ SphFuncVisGridder
... | Evaluates the PROLATE SPHEROIDAL WAVEFUNCTION
m=6, alpha = 1 from Schwab, Indirect Imaging (1984).
This is one factor in the basis function.
| Evaluates the PROLATE SPHEROIDAL WAVEFUNCTION
m=6, alpha = 1 from Schwab, Indirect Imaging (1984).
This is one factor in the basis function. | [
"Evaluates",
"the",
"PROLATE",
"SPHEROIDAL",
"WAVEFUNCTION",
"m",
"=",
"6",
"alpha",
"=",
"1",
"from",
"Schwab",
"Indirect",
"Imaging",
"(",
"1984",
")",
".",
"This",
"is",
"one",
"factor",
"in",
"the",
"basis",
"function",
"."
] | def spheroidal_function(vnu):
Stole this back from Anna!
n_p = 4
n_q = 2
p = numpy.zeros((2, 5))
q = numpy.zeros((2, 3))
p[0, 0] = 8.203343e-2
p[0, 1] = -3.644705e-1
p[0, 2] = 6.278660e-1
p[0, 3] = -5.335581e-1
p[0, 4] = 2.312756e-1
p[1, 0] = 4.028559e-3
p[1, 1] = -3.697... | [
"def",
"spheroidal_function",
"(",
"vnu",
")",
":",
"n_p",
"=",
"4",
"n_q",
"=",
"2",
"p",
"=",
"numpy",
".",
"zeros",
"(",
"(",
"2",
",",
"5",
")",
")",
"q",
"=",
"numpy",
".",
"zeros",
"(",
"(",
"2",
",",
"3",
")",
")",
"p",
"[",
"0",
"... | Evaluates the PROLATE SPHEROIDAL WAVEFUNCTION
m=6, alpha = 1 from Schwab, Indirect Imaging (1984). | [
"Evaluates",
"the",
"PROLATE",
"SPHEROIDAL",
"WAVEFUNCTION",
"m",
"=",
"6",
"alpha",
"=",
"1",
"from",
"Schwab",
"Indirect",
"Imaging",
"(",
"1984",
")",
"."
] | [
"\"\"\" Evaluates the PROLATE SPHEROIDAL WAVEFUNCTION\n\n m=6, alpha = 1 from Schwab, Indirect Imaging (1984).\n This is one factor in the basis function.\n \"\"\"",
"# Code adapted Anna's f90 PROFILE (gridder.f90) code",
"# which was adapted from Tim Cornwell's C++ SphFuncVisGridder",
"# developed f... | [
{
"param": "vnu",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vnu",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | find_global_optimum | <not_specific> | def find_global_optimum(hsmmpsf, ihsmmpsf, smresidual, windowstack, findpeak):
"""Find the optimum peak using one of a number of algorithms
"""
if findpeak == 'Algorithm1':
# Calculate the principal solution in moment-moment axes. This decouples the moments
smpsol = calculate_scale_moment_p... | Find the optimum peak using one of a number of algorithms
| Find the optimum peak using one of a number of algorithms | [
"Find",
"the",
"optimum",
"peak",
"using",
"one",
"of",
"a",
"number",
"of",
"algorithms"
] | def find_global_optimum(hsmmpsf, ihsmmpsf, smresidual, windowstack, findpeak):
if findpeak == 'Algorithm1':
smpsol = calculate_scale_moment_principal_solution(smresidual, ihsmmpsf)
mx, my, mscale = find_optimum_scale_zero_moment(smpsol, windowstack)
mval = smpsol[mscale, :, mx, my]
elif ... | [
"def",
"find_global_optimum",
"(",
"hsmmpsf",
",",
"ihsmmpsf",
",",
"smresidual",
",",
"windowstack",
",",
"findpeak",
")",
":",
"if",
"findpeak",
"==",
"'Algorithm1'",
":",
"smpsol",
"=",
"calculate_scale_moment_principal_solution",
"(",
"smresidual",
",",
"ihsmmps... | Find the optimum peak using one of a number of algorithms | [
"Find",
"the",
"optimum",
"peak",
"using",
"one",
"of",
"a",
"number",
"of",
"algorithms"
] | [
"\"\"\"Find the optimum peak using one of a number of algorithms\n\n \"\"\"",
"# Calculate the principal solution in moment-moment axes. This decouples the moments",
"# Now find the location and scale",
"# CASA 4.7 version",
"# smpsol = calculate_scale_moment_approximate_principal_solution(smresid... | [
{
"param": "hsmmpsf",
"type": null
},
{
"param": "ihsmmpsf",
"type": null
},
{
"param": "smresidual",
"type": null
},
{
"param": "windowstack",
"type": null
},
{
"param": "findpeak",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "hsmmpsf",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ihsmmpsf",
"type": null,
"docstring": null,
"docstring_tok... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | update_scale_moment_residual | <not_specific> | def update_scale_moment_residual(smresidual, ssmmpsf, lhs, rhs, gain, mscale, mval):
""" Update residual by subtracting the effect of model update for each moment
"""
# Lines 30 - 32 of Algorithm 1.
nscales, nmoment, _, _ = smresidual.shape
smresidual[:, :, lhs[0]:lhs[1], lhs[2]:lhs[3]] -= \
... | Update residual by subtracting the effect of model update for each moment
| Update residual by subtracting the effect of model update for each moment | [
"Update",
"residual",
"by",
"subtracting",
"the",
"effect",
"of",
"model",
"update",
"for",
"each",
"moment"
] | def update_scale_moment_residual(smresidual, ssmmpsf, lhs, rhs, gain, mscale, mval):
nscales, nmoment, _, _ = smresidual.shape
smresidual[:, :, lhs[0]:lhs[1], lhs[2]:lhs[3]] -= \
gain * numpy.einsum("stqxy,q->stxy", ssmmpsf[mscale, :, :, :, rhs[0]:rhs[1], rhs[2]:rhs[3]], mval)
return smresidual | [
"def",
"update_scale_moment_residual",
"(",
"smresidual",
",",
"ssmmpsf",
",",
"lhs",
",",
"rhs",
",",
"gain",
",",
"mscale",
",",
"mval",
")",
":",
"nscales",
",",
"nmoment",
",",
"_",
",",
"_",
"=",
"smresidual",
".",
"shape",
"smresidual",
"[",
":",
... | Update residual by subtracting the effect of model update for each moment | [
"Update",
"residual",
"by",
"subtracting",
"the",
"effect",
"of",
"model",
"update",
"for",
"each",
"moment"
] | [
"\"\"\" Update residual by subtracting the effect of model update for each moment\n\n \"\"\"",
"# Lines 30 - 32 of Algorithm 1."
] | [
{
"param": "smresidual",
"type": null
},
{
"param": "ssmmpsf",
"type": null
},
{
"param": "lhs",
"type": null
},
{
"param": "rhs",
"type": null
},
{
"param": "gain",
"type": null
},
{
"param": "mscale",
"type": null
},
{
"param": "mval",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "smresidual",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ssmmpsf",
"type": null,
"docstring": null,
"docstring_t... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | update_moment_model | <not_specific> | def update_moment_model(m_model, scalestack, lhs, rhs, gain, mscale, mval):
"""Update model with an appropriately scaled and centered blob for each moment
"""
# Lines 28 - 33 of Algorithm 1
nmoment, _, _ = m_model.shape
for t in range(nmoment):
# Line 29 of Algorithm 1. Note that the convol... | Update model with an appropriately scaled and centered blob for each moment
| Update model with an appropriately scaled and centered blob for each moment | [
"Update",
"model",
"with",
"an",
"appropriately",
"scaled",
"and",
"centered",
"blob",
"for",
"each",
"moment"
] | def update_moment_model(m_model, scalestack, lhs, rhs, gain, mscale, mval):
nmoment, _, _ = m_model.shape
for t in range(nmoment):
m_model[t, lhs[0]:lhs[1], lhs[2]:lhs[3]] += \
scalestack[mscale, rhs[0]:rhs[1], rhs[2]:rhs[3]] * gain * mval[t]
return m_model | [
"def",
"update_moment_model",
"(",
"m_model",
",",
"scalestack",
",",
"lhs",
",",
"rhs",
",",
"gain",
",",
"mscale",
",",
"mval",
")",
":",
"nmoment",
",",
"_",
",",
"_",
"=",
"m_model",
".",
"shape",
"for",
"t",
"in",
"range",
"(",
"nmoment",
")",
... | Update model with an appropriately scaled and centered blob for each moment | [
"Update",
"model",
"with",
"an",
"appropriately",
"scaled",
"and",
"centered",
"blob",
"for",
"each",
"moment"
] | [
"\"\"\"Update model with an appropriately scaled and centered blob for each moment\n\n \"\"\"",
"# Lines 28 - 33 of Algorithm 1",
"# Line 29 of Algorithm 1. Note that the convolution is implemented here as an",
"# appropriate shift."
] | [
{
"param": "m_model",
"type": null
},
{
"param": "scalestack",
"type": null
},
{
"param": "lhs",
"type": null
},
{
"param": "rhs",
"type": null
},
{
"param": "gain",
"type": null
},
{
"param": "mscale",
"type": null
},
{
"param": "mval",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "m_model",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scalestack",
"type": null,
"docstring": null,
"docstring_t... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | calculate_scale_moment_residual | <not_specific> | def calculate_scale_moment_residual(residual, scalestack):
""" Calculate scale-dependent moment residuals
Part of the initialisation for Algorithm 1: lines 12 - 17
:param scalestack:
:param residual: residual [nmoment, nx, ny]
:return: scale-dependent moment residual [nscales, nmoment, nx, ny]
... | Calculate scale-dependent moment residuals
Part of the initialisation for Algorithm 1: lines 12 - 17
:param scalestack:
:param residual: residual [nmoment, nx, ny]
:return: scale-dependent moment residual [nscales, nmoment, nx, ny]
| Calculate scale-dependent moment residuals
Part of the initialisation for Algorithm 1: lines 12 - 17 | [
"Calculate",
"scale",
"-",
"dependent",
"moment",
"residuals",
"Part",
"of",
"the",
"initialisation",
"for",
"Algorithm",
"1",
":",
"lines",
"12",
"-",
"17"
] | def calculate_scale_moment_residual(residual, scalestack):
nmoment, nx, ny = residual.shape
nscales = scalestack.shape[0]
scale_moment_residual = numpy.zeros([nscales, nmoment, nx, ny])
for t in range(nmoment):
scale_moment_residual[:, t, ...] = convolve_scalestack(scalestack, residual[t, ...])
... | [
"def",
"calculate_scale_moment_residual",
"(",
"residual",
",",
"scalestack",
")",
":",
"nmoment",
",",
"nx",
",",
"ny",
"=",
"residual",
".",
"shape",
"nscales",
"=",
"scalestack",
".",
"shape",
"[",
"0",
"]",
"scale_moment_residual",
"=",
"numpy",
".",
"ze... | Calculate scale-dependent moment residuals
Part of the initialisation for Algorithm 1: lines 12 - 17 | [
"Calculate",
"scale",
"-",
"dependent",
"moment",
"residuals",
"Part",
"of",
"the",
"initialisation",
"for",
"Algorithm",
"1",
":",
"lines",
"12",
"-",
"17"
] | [
"\"\"\" Calculate scale-dependent moment residuals\n\n Part of the initialisation for Algorithm 1: lines 12 - 17\n\n :param scalestack:\n :param residual: residual [nmoment, nx, ny]\n :return: scale-dependent moment residual [nscales, nmoment, nx, ny]\n \"\"\"",
"# Lines 12 - 17 from Algorithm 1"
] | [
{
"param": "residual",
"type": null
},
{
"param": "scalestack",
"type": null
}
] | {
"returns": [
{
"docstring": "scale-dependent moment residual [nscales, nmoment, nx, ny]",
"docstring_tokens": [
"scale",
"-",
"dependent",
"moment",
"residual",
"[",
"nscales",
"nmoment",
"nx",
"ny",
"]"
],... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | calculate_scale_scale_moment_moment_psf | <not_specific> | def calculate_scale_scale_moment_moment_psf(psf, scalestack):
""" Calculate scale-dependent moment psfs
Part of the initialisation for Algorithm 1
:param scalestack:
:param psf: psf
:return: scale-dependent moment psf [nscales, nscales, nmoment, nmoment, nx, ny]
"""
nmoment2, nx, ny = psf.... | Calculate scale-dependent moment psfs
Part of the initialisation for Algorithm 1
:param scalestack:
:param psf: psf
:return: scale-dependent moment psf [nscales, nscales, nmoment, nmoment, nx, ny]
| Calculate scale-dependent moment psfs
Part of the initialisation for Algorithm 1 | [
"Calculate",
"scale",
"-",
"dependent",
"moment",
"psfs",
"Part",
"of",
"the",
"initialisation",
"for",
"Algorithm",
"1"
] | def calculate_scale_scale_moment_moment_psf(psf, scalestack):
nmoment2, nx, ny = psf.shape
nmoment = max(nmoment2 // 2, 1)
nscales = scalestack.shape[0]
scale_scale_moment_moment_psf = numpy.zeros([nscales, nscales, nmoment, nmoment, nx, ny])
for t in range(nmoment):
for q in range(nmoment):... | [
"def",
"calculate_scale_scale_moment_moment_psf",
"(",
"psf",
",",
"scalestack",
")",
":",
"nmoment2",
",",
"nx",
",",
"ny",
"=",
"psf",
".",
"shape",
"nmoment",
"=",
"max",
"(",
"nmoment2",
"//",
"2",
",",
"1",
")",
"nscales",
"=",
"scalestack",
".",
"s... | Calculate scale-dependent moment psfs
Part of the initialisation for Algorithm 1 | [
"Calculate",
"scale",
"-",
"dependent",
"moment",
"psfs",
"Part",
"of",
"the",
"initialisation",
"for",
"Algorithm",
"1"
] | [
"\"\"\" Calculate scale-dependent moment psfs\n\n Part of the initialisation for Algorithm 1\n\n :param scalestack:\n :param psf: psf\n :return: scale-dependent moment psf [nscales, nscales, nmoment, nmoment, nx, ny]\n \"\"\"",
"# Lines 3 - 5 from Algorithm 1"
] | [
{
"param": "psf",
"type": null
},
{
"param": "scalestack",
"type": null
}
] | {
"returns": [
{
"docstring": "scale-dependent moment psf [nscales, nscales, nmoment, nmoment, nx, ny]",
"docstring_tokens": [
"scale",
"-",
"dependent",
"moment",
"psf",
"[",
"nscales",
"nscales",
"nmoment",
"nmoment",
... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | calculate_scale_inverse_moment_moment_hessian | <not_specific> | def calculate_scale_inverse_moment_moment_hessian(scale_scale_moment_moment_psf):
"""Calculate inverse_scale dependent moment moment hessian
Part of the initialisation for Algorithm 1. Lines 7 - 9
:param scale_scale_moment_moment_psf: scale_moment_psf [nscales, nscales, nmoment, nmoment]
:return: scal... | Calculate inverse_scale dependent moment moment hessian
Part of the initialisation for Algorithm 1. Lines 7 - 9
:param scale_scale_moment_moment_psf: scale_moment_psf [nscales, nscales, nmoment, nmoment]
:return: scale-dependent moment-moment inverse hessian
| Calculate inverse_scale dependent moment moment hessian
Part of the initialisation for Algorithm 1. | [
"Calculate",
"inverse_scale",
"dependent",
"moment",
"moment",
"hessian",
"Part",
"of",
"the",
"initialisation",
"for",
"Algorithm",
"1",
"."
] | def calculate_scale_inverse_moment_moment_hessian(scale_scale_moment_moment_psf):
nscales, _, nmoment, _, nx, ny = scale_scale_moment_moment_psf.shape
hessian_shape = [nscales, nmoment, nmoment]
scale_moment_moment_hessian = numpy.zeros(hessian_shape)
scale_inverse_moment_moment_hessian = numpy.zeros(he... | [
"def",
"calculate_scale_inverse_moment_moment_hessian",
"(",
"scale_scale_moment_moment_psf",
")",
":",
"nscales",
",",
"_",
",",
"nmoment",
",",
"_",
",",
"nx",
",",
"ny",
"=",
"scale_scale_moment_moment_psf",
".",
"shape",
"hessian_shape",
"=",
"[",
"nscales",
","... | Calculate inverse_scale dependent moment moment hessian
Part of the initialisation for Algorithm 1. | [
"Calculate",
"inverse_scale",
"dependent",
"moment",
"moment",
"hessian",
"Part",
"of",
"the",
"initialisation",
"for",
"Algorithm",
"1",
"."
] | [
"\"\"\"Calculate inverse_scale dependent moment moment hessian\n\n Part of the initialisation for Algorithm 1. Lines 7 - 9\n\n :param scale_scale_moment_moment_psf: scale_moment_psf [nscales, nscales, nmoment, nmoment]\n :return: scale-dependent moment-moment inverse hessian\n \"\"\""
] | [
{
"param": "scale_scale_moment_moment_psf",
"type": null
}
] | {
"returns": [
{
"docstring": "scale-dependent moment-moment inverse hessian",
"docstring_tokens": [
"scale",
"-",
"dependent",
"moment",
"-",
"moment",
"inverse",
"hessian"
],
"type": null
}
],
"raises": [],
"params... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | calculate_scale_moment_principal_solution | <not_specific> | def calculate_scale_moment_principal_solution(smresidual, ihsmmpsf):
""" Calculate the principal solution in moment space for each scale
Lines 20 - 26
:param smresidual: scale-dependent moment residual [nscales, nmoment, nx, ny]
:param ihsmmpsf: Inverse of scale dependent moment moment Hessian
:re... | Calculate the principal solution in moment space for each scale
Lines 20 - 26
:param smresidual: scale-dependent moment residual [nscales, nmoment, nx, ny]
:param ihsmmpsf: Inverse of scale dependent moment moment Hessian
:return: Decoupled residual images [nscales, nmoment, nx, ny]
| Calculate the principal solution in moment space for each scale
Lines 20 - 26 | [
"Calculate",
"the",
"principal",
"solution",
"in",
"moment",
"space",
"for",
"each",
"scale",
"Lines",
"20",
"-",
"26"
] | def calculate_scale_moment_principal_solution(smresidual, ihsmmpsf):
smpsol = numpy.einsum("smn,smxy->snxy", ihsmmpsf, smresidual)
return smpsol | [
"def",
"calculate_scale_moment_principal_solution",
"(",
"smresidual",
",",
"ihsmmpsf",
")",
":",
"smpsol",
"=",
"numpy",
".",
"einsum",
"(",
"\"smn,smxy->snxy\"",
",",
"ihsmmpsf",
",",
"smresidual",
")",
"return",
"smpsol"
] | Calculate the principal solution in moment space for each scale
Lines 20 - 26 | [
"Calculate",
"the",
"principal",
"solution",
"in",
"moment",
"space",
"for",
"each",
"scale",
"Lines",
"20",
"-",
"26"
] | [
"\"\"\" Calculate the principal solution in moment space for each scale\n\n Lines 20 - 26\n\n :param smresidual: scale-dependent moment residual [nscales, nmoment, nx, ny]\n :param ihsmmpsf: Inverse of scale dependent moment moment Hessian\n :return: Decoupled residual images [nscales, nmoment, nx, ny]\... | [
{
"param": "smresidual",
"type": null
},
{
"param": "ihsmmpsf",
"type": null
}
] | {
"returns": [
{
"docstring": "Decoupled residual images [nscales, nmoment, nx, ny]",
"docstring_tokens": [
"Decoupled",
"residual",
"images",
"[",
"nscales",
"nmoment",
"nx",
"ny",
"]"
],
"type": null
}
],
"ra... |
f84ac4fac6072d73609c632d6907bde4b8dd2ad6 | ska-telescope/algorithm-reference-library | processing_library/arrays/cleaners.py | [
"Apache-2.0"
] | Python | find_optimum_scale_zero_moment | <not_specific> | def find_optimum_scale_zero_moment(smpsol, windowstack):
"""Find the optimum scale for moment zero
Line 27 of Algorithm 1
:param windowstack:
:param smpsol: Decoupled residual images for each scale and moment
:return: x, y, optimum scale for peak
"""
nscales, nmoment, nx, ny = smpsol.shape... | Find the optimum scale for moment zero
Line 27 of Algorithm 1
:param windowstack:
:param smpsol: Decoupled residual images for each scale and moment
:return: x, y, optimum scale for peak
| Find the optimum scale for moment zero
Line 27 of Algorithm 1 | [
"Find",
"the",
"optimum",
"scale",
"for",
"moment",
"zero",
"Line",
"27",
"of",
"Algorithm",
"1"
] | def find_optimum_scale_zero_moment(smpsol, windowstack):
nscales, nmoment, nx, ny = smpsol.shape
sscale = 0
sx = 0
sy = 0
optimum = 0.0
for scale in range(nscales):
if windowstack is not None:
resid = smpsol[scale, 0, :, :] * windowstack[scale, :, :]
else:
... | [
"def",
"find_optimum_scale_zero_moment",
"(",
"smpsol",
",",
"windowstack",
")",
":",
"nscales",
",",
"nmoment",
",",
"nx",
",",
"ny",
"=",
"smpsol",
".",
"shape",
"sscale",
"=",
"0",
"sx",
"=",
"0",
"sy",
"=",
"0",
"optimum",
"=",
"0.0",
"for",
"scale... | Find the optimum scale for moment zero
Line 27 of Algorithm 1 | [
"Find",
"the",
"optimum",
"scale",
"for",
"moment",
"zero",
"Line",
"27",
"of",
"Algorithm",
"1"
] | [
"\"\"\"Find the optimum scale for moment zero\n\n Line 27 of Algorithm 1\n\n :param windowstack:\n :param smpsol: Decoupled residual images for each scale and moment\n :return: x, y, optimum scale for peak\n \"\"\""
] | [
{
"param": "smpsol",
"type": null
},
{
"param": "windowstack",
"type": null
}
] | {
"returns": [
{
"docstring": "x, y, optimum scale for peak",
"docstring_tokens": [
"x",
"y",
"optimum",
"scale",
"for",
"peak"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "smpsol",
"type": null,
... |
31d3be98b6bcb699c4f39ac5199eded466c6a477 | ska-telescope/algorithm-reference-library | workflows/shared/imaging/imaging_shared.py | [
"Apache-2.0"
] | Python | sum_invert_results_local | <not_specific> | def sum_invert_results_local(image_list):
""" Sum a set of invert results with appropriate weighting
without normalize_sumwt at the end
:param image_list: List of [image, sum weights] pairs
:return: image, sum of weights
"""
first = True
sumwt = 0.0
im = None
for i, arg in enume... | Sum a set of invert results with appropriate weighting
without normalize_sumwt at the end
:param image_list: List of [image, sum weights] pairs
:return: image, sum of weights
| Sum a set of invert results with appropriate weighting
without normalize_sumwt at the end | [
"Sum",
"a",
"set",
"of",
"invert",
"results",
"with",
"appropriate",
"weighting",
"without",
"normalize_sumwt",
"at",
"the",
"end"
] | def sum_invert_results_local(image_list):
first = True
sumwt = 0.0
im = None
for i, arg in enumerate(image_list):
if arg is not None:
if isinstance(arg[1], numpy.ndarray):
scale = arg[1][..., numpy.newaxis, numpy.newaxis]
else:
scale = arg[... | [
"def",
"sum_invert_results_local",
"(",
"image_list",
")",
":",
"first",
"=",
"True",
"sumwt",
"=",
"0.0",
"im",
"=",
"None",
"for",
"i",
",",
"arg",
"in",
"enumerate",
"(",
"image_list",
")",
":",
"if",
"arg",
"is",
"not",
"None",
":",
"if",
"isinstan... | Sum a set of invert results with appropriate weighting
without normalize_sumwt at the end | [
"Sum",
"a",
"set",
"of",
"invert",
"results",
"with",
"appropriate",
"weighting",
"without",
"normalize_sumwt",
"at",
"the",
"end"
] | [
"\"\"\" Sum a set of invert results with appropriate weighting\n without normalize_sumwt at the end\n :param image_list: List of [image, sum weights] pairs\n :return: image, sum of weights\n \"\"\""
] | [
{
"param": "image_list",
"type": null
}
] | {
"returns": [
{
"docstring": "image, sum of weights",
"docstring_tokens": [
"image",
"sum",
"of",
"weights"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "image_list",
"type": null,
"docstring": "List of [ima... |
31d3be98b6bcb699c4f39ac5199eded466c6a477 | ska-telescope/algorithm-reference-library | workflows/shared/imaging/imaging_shared.py | [
"Apache-2.0"
] | Python | sum_invert_results | <not_specific> | def sum_invert_results(image_list, normalize=True):
""" Sum a set of invert results with appropriate weighting
:param image_list: List of [image, sum weights] pairs
:return: image, sum of weights
"""
if len(image_list) == 1:
return image_list[0]
im = create_empty_image_like(image_l... | Sum a set of invert results with appropriate weighting
:param image_list: List of [image, sum weights] pairs
:return: image, sum of weights
| Sum a set of invert results with appropriate weighting | [
"Sum",
"a",
"set",
"of",
"invert",
"results",
"with",
"appropriate",
"weighting"
] | def sum_invert_results(image_list, normalize=True):
if len(image_list) == 1:
return image_list[0]
im = create_empty_image_like(image_list[0][0])
sumwt = image_list[0][1].copy()
sumwt *= 0.0
for i, arg in enumerate(image_list):
if arg is not None:
im.data += arg[1][..., nu... | [
"def",
"sum_invert_results",
"(",
"image_list",
",",
"normalize",
"=",
"True",
")",
":",
"if",
"len",
"(",
"image_list",
")",
"==",
"1",
":",
"return",
"image_list",
"[",
"0",
"]",
"im",
"=",
"create_empty_image_like",
"(",
"image_list",
"[",
"0",
"]",
"... | Sum a set of invert results with appropriate weighting | [
"Sum",
"a",
"set",
"of",
"invert",
"results",
"with",
"appropriate",
"weighting"
] | [
"\"\"\" Sum a set of invert results with appropriate weighting\n\n :param image_list: List of [image, sum weights] pairs\n :return: image, sum of weights\n \"\"\""
] | [
{
"param": "image_list",
"type": null
},
{
"param": "normalize",
"type": null
}
] | {
"returns": [
{
"docstring": "image, sum of weights",
"docstring_tokens": [
"image",
"sum",
"of",
"weights"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "image_list",
"type": null,
"docstring": "List of [ima... |
31d3be98b6bcb699c4f39ac5199eded466c6a477 | ska-telescope/algorithm-reference-library | workflows/shared/imaging/imaging_shared.py | [
"Apache-2.0"
] | Python | remove_sumwt | <not_specific> | def remove_sumwt(results):
""" Remove sumwt term in list of tuples (image, sumwt)
:param results:
:return: A list of just the dirty images
"""
return [d[0] for d in results] | Remove sumwt term in list of tuples (image, sumwt)
:param results:
:return: A list of just the dirty images
| Remove sumwt term in list of tuples (image, sumwt) | [
"Remove",
"sumwt",
"term",
"in",
"list",
"of",
"tuples",
"(",
"image",
"sumwt",
")"
] | def remove_sumwt(results):
return [d[0] for d in results] | [
"def",
"remove_sumwt",
"(",
"results",
")",
":",
"return",
"[",
"d",
"[",
"0",
"]",
"for",
"d",
"in",
"results",
"]"
] | Remove sumwt term in list of tuples (image, sumwt) | [
"Remove",
"sumwt",
"term",
"in",
"list",
"of",
"tuples",
"(",
"image",
"sumwt",
")"
] | [
"\"\"\" Remove sumwt term in list of tuples (image, sumwt)\n\n :param results:\n :return: A list of just the dirty images\n \"\"\""
] | [
{
"param": "results",
"type": null
}
] | {
"returns": [
{
"docstring": "A list of just the dirty images",
"docstring_tokens": [
"A",
"list",
"of",
"just",
"the",
"dirty",
"images"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "results",
... |
31d3be98b6bcb699c4f39ac5199eded466c6a477 | ska-telescope/algorithm-reference-library | workflows/shared/imaging/imaging_shared.py | [
"Apache-2.0"
] | Python | sum_predict_results | <not_specific> | def sum_predict_results(results):
""" Sum a set of predict results of the same shape
:param results: List of visibilities to be summed
:return: summed visibility
"""
sum_results = None
for result in results:
if result is not None:
if sum_results is None:
sum_... | Sum a set of predict results of the same shape
:param results: List of visibilities to be summed
:return: summed visibility
| Sum a set of predict results of the same shape | [
"Sum",
"a",
"set",
"of",
"predict",
"results",
"of",
"the",
"same",
"shape"
] | def sum_predict_results(results):
sum_results = None
for result in results:
if result is not None:
if sum_results is None:
sum_results = copy_visibility(result)
else:
assert sum_results.data['vis'].shape == result.data['vis'].shape
... | [
"def",
"sum_predict_results",
"(",
"results",
")",
":",
"sum_results",
"=",
"None",
"for",
"result",
"in",
"results",
":",
"if",
"result",
"is",
"not",
"None",
":",
"if",
"sum_results",
"is",
"None",
":",
"sum_results",
"=",
"copy_visibility",
"(",
"result",... | Sum a set of predict results of the same shape | [
"Sum",
"a",
"set",
"of",
"predict",
"results",
"of",
"the",
"same",
"shape"
] | [
"\"\"\" Sum a set of predict results of the same shape\n\n :param results: List of visibilities to be summed\n :return: summed visibility\n \"\"\""
] | [
{
"param": "results",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "results",
"type": null,
"docstring": "List of visibilities to be summed",
"docstring_tokens": [
"List",
... |
31d3be98b6bcb699c4f39ac5199eded466c6a477 | ska-telescope/algorithm-reference-library | workflows/shared/imaging/imaging_shared.py | [
"Apache-2.0"
] | Python | threshold_list | <not_specific> | def threshold_list(imagelist, threshold, fractional_threshold, use_moment0=True, prefix=''):
""" Find actual threshold for list of results, optionally using moment 0
:param imagelist:
:param threshold: Absolute threshold
:param fractional_threshold: Fractional threshold
:param use_moment0: Use mom... | Find actual threshold for list of results, optionally using moment 0
:param imagelist:
:param threshold: Absolute threshold
:param fractional_threshold: Fractional threshold
:param use_moment0: Use moment 0 for threshold
:return:
| Find actual threshold for list of results, optionally using moment 0 | [
"Find",
"actual",
"threshold",
"for",
"list",
"of",
"results",
"optionally",
"using",
"moment",
"0"
] | def threshold_list(imagelist, threshold, fractional_threshold, use_moment0=True, prefix=''):
peak = 0.0
for i, result in enumerate(imagelist):
if use_moment0:
moments = calculate_image_frequency_moments(result)
this_peak = numpy.max(numpy.abs(moments.data[0, ...] / result.shape[0... | [
"def",
"threshold_list",
"(",
"imagelist",
",",
"threshold",
",",
"fractional_threshold",
",",
"use_moment0",
"=",
"True",
",",
"prefix",
"=",
"''",
")",
":",
"peak",
"=",
"0.0",
"for",
"i",
",",
"result",
"in",
"enumerate",
"(",
"imagelist",
")",
":",
"... | Find actual threshold for list of results, optionally using moment 0 | [
"Find",
"actual",
"threshold",
"for",
"list",
"of",
"results",
"optionally",
"using",
"moment",
"0"
] | [
"\"\"\" Find actual threshold for list of results, optionally using moment 0\n\n :param imagelist:\n :param threshold: Absolute threshold\n :param fractional_threshold: Fractional threshold\n :param use_moment0: Use moment 0 for threshold\n :return:\n \"\"\""
] | [
{
"param": "imagelist",
"type": null
},
{
"param": "threshold",
"type": null
},
{
"param": "fractional_threshold",
"type": null
},
{
"param": "use_moment0",
"type": null
},
{
"param": "prefix",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "imagelist",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
c4f78f10dd8454302a8ea44e768ff3ff43e26f6c | ska-telescope/algorithm-reference-library | processing_components/image/operations.py | [
"Apache-2.0"
] | Python | reproject_image | (Image, Image) | def reproject_image(im: Image, newwcs: WCS, shape=None) -> (Image, Image):
""" Re-project an image to a new coordinate system
Currently uses the reproject python package. This seems to have some features do be careful using this method.
For timeslice imaging I had to use griddata.
:param im: Imag... | Re-project an image to a new coordinate system
Currently uses the reproject python package. This seems to have some features do be careful using this method.
For timeslice imaging I had to use griddata.
:param im: Image to be reprojected
:param newwcs: New WCS
:param shape:
:return: Repr... | Re-project an image to a new coordinate system
Currently uses the reproject python package. This seems to have some features do be careful using this method.
For timeslice imaging I had to use griddata. | [
"Re",
"-",
"project",
"an",
"image",
"to",
"a",
"new",
"coordinate",
"system",
"Currently",
"uses",
"the",
"reproject",
"python",
"package",
".",
"This",
"seems",
"to",
"have",
"some",
"features",
"do",
"be",
"careful",
"using",
"this",
"method",
".",
"For... | def reproject_image(im: Image, newwcs: WCS, shape=None) -> (Image, Image):
assert isinstance(im, Image), im
rep, foot = reproject_interp((im.data, im.wcs), newwcs, shape, order='bicubic')
return create_image_from_array(rep, newwcs, im.polarisation_frame), create_image_from_array(foot, newwcs,
... | [
"def",
"reproject_image",
"(",
"im",
":",
"Image",
",",
"newwcs",
":",
"WCS",
",",
"shape",
"=",
"None",
")",
"->",
"(",
"Image",
",",
"Image",
")",
":",
"assert",
"isinstance",
"(",
"im",
",",
"Image",
")",
",",
"im",
"rep",
",",
"foot",
"=",
"r... | Re-project an image to a new coordinate system
Currently uses the reproject python package. | [
"Re",
"-",
"project",
"an",
"image",
"to",
"a",
"new",
"coordinate",
"system",
"Currently",
"uses",
"the",
"reproject",
"python",
"package",
"."
] | [
"\"\"\" Re-project an image to a new coordinate system\n \n Currently uses the reproject python package. This seems to have some features do be careful using this method.\n For timeslice imaging I had to use griddata.\n\n\n :param im: Image to be reprojected\n :param newwcs: New WCS\n :param shape... | [
{
"param": "im",
"type": "Image"
},
{
"param": "newwcs",
"type": "WCS"
},
{
"param": "shape",
"type": null
}
] | {
"returns": [
{
"docstring": "Reprojected Image, Footprint Image",
"docstring_tokens": [
"Reprojected",
"Image",
"Footprint",
"Image"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "im",
"type": "Image",
"docs... |
c4f78f10dd8454302a8ea44e768ff3ff43e26f6c | ska-telescope/algorithm-reference-library | processing_components/image/operations.py | [
"Apache-2.0"
] | Python | qa_image | QA | def qa_image(im, context="") -> QA:
"""Assess the quality of an image
:param im:
:return: QA
"""
assert isinstance(im, Image), im
data = {'shape': str(im.data.shape),
'max': numpy.max(im.data),
'min': numpy.min(im.data),
'maxabs': numpy.max(numpy.abs(im.data)... | Assess the quality of an image
:param im:
:return: QA
| Assess the quality of an image | [
"Assess",
"the",
"quality",
"of",
"an",
"image"
] | def qa_image(im, context="") -> QA:
assert isinstance(im, Image), im
data = {'shape': str(im.data.shape),
'max': numpy.max(im.data),
'min': numpy.min(im.data),
'maxabs': numpy.max(numpy.abs(im.data)),
'rms': numpy.std(im.data),
'sum': numpy.sum(im.data... | [
"def",
"qa_image",
"(",
"im",
",",
"context",
"=",
"\"\"",
")",
"->",
"QA",
":",
"assert",
"isinstance",
"(",
"im",
",",
"Image",
")",
",",
"im",
"data",
"=",
"{",
"'shape'",
":",
"str",
"(",
"im",
".",
"data",
".",
"shape",
")",
",",
"'max'",
... | Assess the quality of an image | [
"Assess",
"the",
"quality",
"of",
"an",
"image"
] | [
"\"\"\"Assess the quality of an image\n\n :param im:\n :return: QA\n \"\"\""
] | [
{
"param": "im",
"type": null
},
{
"param": "context",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "im",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"i... |
c4f78f10dd8454302a8ea44e768ff3ff43e26f6c | ska-telescope/algorithm-reference-library | processing_components/image/operations.py | [
"Apache-2.0"
] | Python | show_image | <not_specific> | def show_image(im: Image, fig=None, title: str = '', pol=0, chan=0, cm='Greys', components=None,
vmin=None, vmax=None, vscale=1.0):
""" Show an Image with coordinates using matplotlib, optionally with components
:param im: Image
:param fig: Matplotlib figure
:param title:
:param pol:... | Show an Image with coordinates using matplotlib, optionally with components
:param im: Image
:param fig: Matplotlib figure
:param title:
:param pol: Polarisation
:param chan: Channel
:param components: Optional components
:param vmin: Clip to this minimum
:param vmax: Clip to this maxi... | Show an Image with coordinates using matplotlib, optionally with components | [
"Show",
"an",
"Image",
"with",
"coordinates",
"using",
"matplotlib",
"optionally",
"with",
"components"
] | def show_image(im: Image, fig=None, title: str = '', pol=0, chan=0, cm='Greys', components=None,
vmin=None, vmax=None, vscale=1.0):
import matplotlib.pyplot as plt
assert isinstance(im, Image), im
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection=im.wcs.sub([1,2]))
if len(im... | [
"def",
"show_image",
"(",
"im",
":",
"Image",
",",
"fig",
"=",
"None",
",",
"title",
":",
"str",
"=",
"''",
",",
"pol",
"=",
"0",
",",
"chan",
"=",
"0",
",",
"cm",
"=",
"'Greys'",
",",
"components",
"=",
"None",
",",
"vmin",
"=",
"None",
",",
... | Show an Image with coordinates using matplotlib, optionally with components | [
"Show",
"an",
"Image",
"with",
"coordinates",
"using",
"matplotlib",
"optionally",
"with",
"components"
] | [
"\"\"\" Show an Image with coordinates using matplotlib, optionally with components\n\n :param im: Image\n :param fig: Matplotlib figure\n :param title:\n :param pol: Polarisation\n :param chan: Channel\n :param components: Optional components\n :param vmin: Clip to this minimum\n :param vma... | [
{
"param": "im",
"type": "Image"
},
{
"param": "fig",
"type": null
},
{
"param": "title",
"type": "str"
},
{
"param": "pol",
"type": null
},
{
"param": "chan",
"type": null
},
{
"param": "cm",
"type": null
},
{
"param": "components",
"t... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "im",
"type": "Image",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.