index
int64
0
731k
package
stringlengths
2
98
name
stringlengths
1
76
docstring
stringlengths
0
281k
code
stringlengths
4
8.19k
signature
stringlengths
2
42.8k
embed_func_code
listlengths
768
768
722,041
apprise.plugins.base
parse_url
Parses the URL and returns it broken apart into a dictionary. This is very specific and customized for Apprise. Args: url (str): The URL you want to fully parse. verify_host (:obj:`bool`, optional): a flag kept with the parsed URL which some child classes will...
@staticmethod def parse_url(url, verify_host=True, plus_to_space=False): """Parses the URL and returns it broken apart into a dictionary. This is very specific and customized for Apprise. Args: url (str): The URL you want to fully parse. verify_host (:obj:`bool`, optional): a flag kept with ...
(url, verify_host=True, plus_to_space=False)
[ -0.03148898854851723, -0.05951026827096939, -0.01195052731782198, 0.032216086983680725, -0.01786985993385315, 0.0053087561391294, 0.010253962129354477, -0.0042414115741848946, 0.0150826470926404, 0.0013062149519100785, 0.02017234079539776, 0.042209040373563766, 0.04261919856071472, 0.03437...
722,046
apprise.plugins.base
send
Should preform the actual notification itself.
def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): """ Should preform the actual notification itself. """ raise NotImplementedError( "send() is not implimented by the child class.")
(self, body, title='', notify_type='info', **kwargs)
[ -0.009546549059450626, -0.0012357429368421435, 0.01663031429052353, 0.006096041761338711, 0.02180825173854828, -0.08597985655069351, -0.023809807375073433, 0.08235965669155121, 0.015142201445996761, 0.006644293665885925, 0.04389498010277748, -0.03045845218002796, 0.013010109774768353, -0.0...
722,051
apprise.plugins.base
url_parameters
Provides a default set of parameters to work with. This can greatly simplify URL construction in the acommpanied url() function in all defined plugin services.
def url_parameters(self, *args, **kwargs): """ Provides a default set of parameters to work with. This can greatly simplify URL construction in the acommpanied url() function in all defined plugin services. """ params = { 'format': self.notify_format, 'overflow': self.overflow_mo...
(self, *args, **kwargs)
[ -0.028539404273033142, -0.031036145985126495, 0.027172574773430824, -0.023126758635044098, -0.03517308458685875, 0.032967932522296906, -0.03987497836351395, -0.001039360067807138, 0.04698249325156212, -0.010105427354574203, -0.007102958392351866, -0.004232615698128939, -0.03746935725212097, ...
722,053
apprise.common
NotifyFormat
A list of pre-defined text message formats that can be passed via the apprise library.
class NotifyFormat: """ A list of pre-defined text message formats that can be passed via the apprise library. """ TEXT = 'text' HTML = 'html' MARKDOWN = 'markdown'
()
[ 0.020743779838085175, -0.0662240982055664, 0.03127352148294449, -0.04847024381160736, 0.021040914580225945, -0.049621645361185074, 0.023882273584604263, -0.011049729771912098, 0.04765312373638153, -0.0010243053548038006, 0.015144630335271358, 0.017531000077724457, -0.011486148461699486, 0....
722,054
apprise.common
NotifyImageSize
A list of pre-defined image sizes to make it easier to work with defined plugins.
class NotifyImageSize: """ A list of pre-defined image sizes to make it easier to work with defined plugins. """ XY_32 = '32x32' XY_72 = '72x72' XY_128 = '128x128' XY_256 = '256x256'
()
[ 0.06604856997728348, -0.11401621252298355, -0.06682853400707245, -0.016033530235290527, 0.005300194025039673, 0.0004301421868149191, 0.01925087161362171, 0.0008397882338613272, 0.004114740993827581, 0.014429289847612381, 0.04250790923833847, 0.012904820032417774, 0.0321202389895916, 0.0003...
722,055
apprise.common
NotifyType
A simple mapping of notification types most commonly used with all types of logging and notification services.
class NotifyType: """ A simple mapping of notification types most commonly used with all types of logging and notification services. """ INFO = 'info' SUCCESS = 'success' WARNING = 'warning' FAILURE = 'failure'
()
[ 0.03530154377222061, -0.023414866998791695, -0.02490541897714138, -0.05147119611501694, 0.041622236371040344, -0.07664076238870621, -0.005334853660315275, -0.010396125726401806, 0.030792152509093285, -0.04079205542802811, -0.013282889500260353, 0.0011509321630001068, 0.012207427993416786, ...
722,056
apprise.common
OverflowMode
A list of pre-defined modes of how to handle the text when it exceeds the defined maximum message size.
class OverflowMode: """ A list of pre-defined modes of how to handle the text when it exceeds the defined maximum message size. """ # Send the data as is; untouched. Let the upstream server decide how the # content is handled. Some upstream services might gracefully handle this # with exp...
()
[ -0.001744267763569951, -0.005088373553007841, -0.021046755835413933, -0.020157957449555397, 0.019909093156456947, -0.009332387708127499, 0.0009604582446627319, -0.03828945383429527, 0.02421087957918644, -0.08688897639513016, 0.01770487241446972, -0.019909093156456947, -0.03620966523885727, ...
722,057
apprise.url
PrivacyMode
null
class PrivacyMode: # Defines different privacy modes strings can be printed as # Astrisk sets 4 of them: e.g. **** # This is used for passwords Secret = '*' # Outer takes the first and last character displaying them with # 3 dots between. Hence, 'i-am-a-token' would become 'i...n' Outer = ...
()
[ -0.011449174955487251, 0.007990946061909199, 0.029164697974920273, -0.017959313467144966, 0.07490722090005875, -0.04229332506656647, 0.03709243983030319, -0.04153486341238022, 0.020153436809778214, -0.022808056324720383, -0.027413008734583855, 0.029218873009085655, -0.038175955414772034, 0...
722,058
apprise.url
URLBase
This is the base class for all URL Manipulation
class URLBase: """ This is the base class for all URL Manipulation """ # The default descriptive name associated with the URL service_name = None # The default simple (insecure) protocol # all inheriting entries must provide their protocol lookup # protocol:// (in this example they wou...
(asset=None, **kwargs)
[ -0.00764715438708663, -0.0629815012216568, -0.05051947385072708, -0.008947905153036118, 0.018567165359854698, -0.00906853936612606, -0.03449086844921112, 0.02546953409910202, -0.055093079805374146, -0.06516340374946594, 0.01653211936354637, 0.059331007301807404, 0.02023506350815296, -0.004...
722,060
apprise.url
__init__
Initialize some general logging and common server arguments that will keep things consistent when working with the children that inherit this class.
def __init__(self, asset=None, **kwargs): """ Initialize some general logging and common server arguments that will keep things consistent when working with the children that inherit this class. """ # Prepare our Asset Object self.asset = \ asset if isinstance(asset, AppriseAsset) el...
(self, asset=None, **kwargs)
[ -0.019438376650214195, -0.07440546154975891, -0.02761155553162098, 0.032869961112737656, 0.007503568194806576, -0.05085095390677452, 0.005361801479011774, 0.032476071268320084, -0.036789149045944214, -0.014849580824375153, 0.01292937621474266, 0.05104789510369301, 0.005932939238846302, -0....
722,067
apprise.url
parse_url
Parses the URL and returns it broken apart into a dictionary. This is very specific and customized for Apprise. Args: url (str): The URL you want to fully parse. verify_host (:obj:`bool`, optional): a flag kept with the parsed URL which some child classes will...
@staticmethod def parse_url(url, verify_host=True, plus_to_space=False, strict_port=False, sanitize=True): """Parses the URL and returns it broken apart into a dictionary. This is very specific and customized for Apprise. Args: url (str): The URL you want to fully parse. verify...
(url, verify_host=True, plus_to_space=False, strict_port=False, sanitize=True)
[ -0.03843243047595024, -0.025767197832465172, -0.021581847220659256, 0.0394514724612236, -0.018797680735588074, 0.008880220353603363, 0.03381034731864929, -0.022218748927116394, 0.00557288434356451, 0.001662766677327454, -0.001230583875440061, 0.02715018205344677, 0.044510286301374435, 0.02...
722,097
pytest_socket
SocketBlockedError
null
class SocketBlockedError(RuntimeError): def __init__(self, *_args, **_kwargs): super().__init__("A test tried to use socket.socket.")
(*_args, **_kwargs)
[ -0.017240887507796288, -0.04419936612248421, -0.02681915834546089, 0.05130470171570778, -0.03486490622162819, -0.022831115871667862, -0.014733122661709785, 0.06060433387756348, -0.009595685638487339, -0.0551011823117733, 0.054857369512319565, 0.07272519916296005, -0.021803628653287888, -0....
722,098
pytest_socket
__init__
null
def __init__(self, *_args, **_kwargs): super().__init__("A test tried to use socket.socket.")
(self, *_args, **_kwargs)
[ -0.03096008487045765, -0.03720858693122864, 0.015162322670221329, 0.012073374353349209, -0.006897179875522852, -0.021869752556085587, 0.004545166622847319, 0.07808861136436462, 0.0004473458684515208, -0.04832879826426506, 0.025152863934636116, 0.09192709624767303, -0.023211238905787468, -0...
722,099
pytest_socket
SocketConnectBlockedError
null
class SocketConnectBlockedError(RuntimeError): def __init__(self, allowed, host, *_args, **_kwargs): if allowed: allowed = ",".join(allowed) super().__init__( "A test tried to use socket.socket.connect() " f'with host "{host}" (allowed: "{allowed}").' )
(allowed, host, *_args, **_kwargs)
[ -0.05022284761071205, -0.036785878241062164, -0.017145222052931786, 0.037274494767189026, -0.04271908476948738, -0.010836826637387276, 0.006194965448230505, 0.037379201501607895, 0.023767726495862007, -0.06236846745014191, 0.05043225362896919, 0.06973262131214142, 0.008092719130218029, -0....
722,100
pytest_socket
__init__
null
def __init__(self, allowed, host, *_args, **_kwargs): if allowed: allowed = ",".join(allowed) super().__init__( "A test tried to use socket.socket.connect() " f'with host "{host}" (allowed: "{allowed}").' )
(self, allowed, host, *_args, **_kwargs)
[ -0.03896871209144592, -0.015216103754937649, 0.014283248223364353, -0.007414440158754587, -0.03284354880452156, -0.013262387365102768, 0.014758476056158543, 0.03140026330947876, 0.033952414989471436, -0.04213690012693405, 0.0199595857411623, 0.08645633608102798, -0.0200123880058527, 0.0106...
722,101
pytest_socket
_is_unix_socket
null
def _is_unix_socket(family) -> bool: try: is_unix_socket = family == socket.AF_UNIX except AttributeError: # AF_UNIX not supported on Windows https://bugs.python.org/issue33408 is_unix_socket = False return is_unix_socket
(family) -> bool
[ 0.03481482341885567, -0.0007833119016140699, 0.007727954536676407, 0.012689110822975636, 0.0009697888744994998, 0.025326181203126907, 0.010911073535680771, 0.04825851693749428, -0.0027364417910575867, -0.03396483510732651, 0.04170146584510803, 0.0019482511561363935, -0.008551922626793385, ...
722,102
pytest_socket
_remove_restrictions
restore socket.socket.* to allow access to the Internet. useful in testing.
def _remove_restrictions(): """restore socket.socket.* to allow access to the Internet. useful in testing.""" socket.socket = _true_socket socket.socket.connect = _true_connect
()
[ -0.009200992994010448, 0.032577428966760635, 0.02160233072936535, 0.01781061664223671, -0.05464937537908554, -0.009009667672216892, -0.04723987728357315, 0.013366659171879292, 0.03186430782079697, 0.00722251832485199, -0.03289050608873367, 0.0037003993056714535, -0.035395123064517975, -0.0...
722,103
pytest_socket
_resolve_allow_hosts
Resolve `allow_hosts` behaviors.
def _resolve_allow_hosts(item): """Resolve `allow_hosts` behaviors.""" mark_restrictions = item.get_closest_marker("allow_hosts") cli_restrictions = item.config.__socket_allow_hosts hosts = None if mark_restrictions: hosts = mark_restrictions.args[0] elif cli_restrictions: hosts ...
(item)
[ 0.04195360094308853, -0.020095568150281906, -0.026177803054451942, -0.008890085853636265, -0.0021566450595855713, 0.02216905727982521, 0.07340152561664581, -0.041227880865335464, 0.025693990290164948, -0.012544610537588596, 0.03317582979798317, 0.000819676264654845, -0.0180739164352417, -0...
722,124
pytest_socket
disable_socket
disable socket.socket to disable the Internet. useful in testing.
def disable_socket(allow_unix_socket=False): """disable socket.socket to disable the Internet. useful in testing.""" class GuardedSocket(socket.socket): """socket guard to disable socket creation (from pytest-socket)""" def __new__(cls, family=-1, type=-1, proto=-1, fileno=None): i...
(allow_unix_socket=False)
[ 0.04706377536058426, 0.009702351875603199, 0.0008144903695210814, 0.006199447438120842, -0.036797840148210526, 0.0026141726411879063, -0.06551472097635269, 0.03763021156191826, -0.02230066992342472, -0.026531901210546494, 0.027763118967413902, -0.0021535493433475494, -0.04106375202536583, ...
722,125
pytest_socket
enable_socket
re-enable socket.socket to enable the Internet. useful in testing.
def enable_socket(): """re-enable socket.socket to enable the Internet. useful in testing.""" socket.socket = _true_socket
()
[ -0.012418699450790882, -0.006651971489191055, 0.02809172309935093, 0.005530663300305605, 0.008683815598487854, 0.013354528695344925, -0.05105746537446976, 0.04495349898934364, -0.009299270808696747, -0.017772313207387924, 0.018497370183467865, -0.06023027002811432, -0.035848140716552734, -...
722,126
pytest_socket
host_from_address
null
def host_from_address(address): host = address[0] if isinstance(host, str): return host
(address)
[ 0.042899083346128464, 0.06654290854930878, -0.02321857586503029, -0.03541470691561699, -0.0027194649446755648, -0.03451317921280861, 0.04800206422805786, 0.01319121289998293, 0.04330731928348541, -0.07219021022319794, 0.03196168690919876, 0.049056682735681534, -0.06195022165775299, -0.0400...
722,127
pytest_socket
host_from_connect_args
null
def host_from_connect_args(args): address = args[0] if isinstance(address, tuple): return host_from_address(address)
(args)
[ -0.015050341375172138, -0.010927893221378326, -0.006026098504662514, -0.026659630239009857, 0.006009063683450222, 0.008398209698498249, 0.015510283410549164, 0.04272354766726494, 0.05205867812037468, -0.08640105277299881, 0.016149092465639114, 0.08299407362937927, -0.02952149510383606, 0.0...
722,129
pytest_socket
is_ipaddress
Determine if the address is a valid IPv4 or IPv6 address.
def is_ipaddress(address: str) -> bool: """ Determine if the address is a valid IPv4 or IPv6 address. """ try: ipaddress.ip_address(address) return True except ValueError: return False
(address: str) -> bool
[ 0.0316341407597065, 0.007638381328433752, -0.018143879249691963, -0.01222663838416338, -0.04099366068840027, -0.012331214733421803, 0.011172167025506496, -0.01243579015135765, 0.05239241197705269, -0.06434889137744904, 0.033202774822711945, 0.029420621693134308, 0.008596991188824177, -0.02...
722,131
pytest_socket
normalize_allowed_hosts
Map all items in `allowed_hosts` to IP addresses.
def normalize_allowed_hosts( allowed_hosts: typing.List[str], ) -> typing.Dict[str, typing.Set[str]]: """Map all items in `allowed_hosts` to IP addresses.""" ip_hosts = defaultdict(set) for host in allowed_hosts: host = host.strip() if is_ipaddress(host): ip_hosts[host].add(h...
(allowed_hosts: List[str]) -> Dict[str, Set[str]]
[ 0.03194284439086914, -0.017779167741537094, -0.07118897885084152, -0.04280738905072212, -0.06638038158416748, -0.007592527195811272, 0.06685039401054382, -0.03984269127249718, 0.03154514357447624, 0.012184198014438152, -0.0005101229180581868, -0.011605720035731792, -0.006083060521632433, -...
722,133
pytest_socket
pytest_addoption
null
def pytest_addoption(parser): group = parser.getgroup("socket") group.addoption( "--disable-socket", action="store_true", dest="disable_socket", help="Disable socket.socket by default to block network calls.", ) group.addoption( "--force-enable-socket", ac...
(parser)
[ -0.01751701533794403, 0.013992195948958397, 0.017276078462600708, 0.010047967545688152, -0.0026592311915010214, 0.008704965934157372, -0.004774122964590788, 0.021202459931373596, -0.05928836017847061, -0.03606916964054108, 0.05161406844854355, -0.028109321370720863, -0.02684217132627964, -...
722,134
pytest_socket
pytest_configure
null
def pytest_configure(config): config.addinivalue_line( "markers", "disable_socket(): Disable socket connections for a specific test" ) config.addinivalue_line( "markers", "enable_socket(): Enable socket connections for a specific test" ) config.addinivalue_line( "markers", ...
(config)
[ 0.024208011105656624, -0.032787371426820755, 0.033352043479681015, -0.05409916490316391, -0.02923540771007538, 0.04542872682213783, -0.06612119823694229, 0.015655970200896263, -0.03641219809651375, -0.005141242407262325, 0.013069410808384418, -0.03612075746059418, -0.02400764264166355, 0.0...
722,135
pytest_socket
pytest_runtest_setup
During each test item's setup phase, choose the behavior based on the configurations supplied. This is the bulk of the logic for the plugin. As the logic can be extensive, this method is allowed complexity. It may be refactored in the future to be more readable. If the given item is not a function...
def pytest_runtest_setup(item) -> None: """During each test item's setup phase, choose the behavior based on the configurations supplied. This is the bulk of the logic for the plugin. As the logic can be extensive, this method is allowed complexity. It may be refactored in the future to be more rea...
(item) -> NoneType
[ 0.020459966734051704, -0.0031048734672367573, 0.0031163732055574656, -0.031186729669570923, 0.008325660601258278, 0.02927320823073387, 0.010919955559074879, 0.015878552570939064, -0.01119594369083643, 0.015777356922626495, 0.015308177098631859, 0.03508737310767174, 0.007235505152493715, 0....
722,136
pytest_socket
pytest_runtest_teardown
null
def pytest_runtest_teardown(): _remove_restrictions()
()
[ 0.03460219129920006, 0.04156278446316719, 0.009420228190720081, -0.009612648747861385, -0.03187483921647072, 0.009169246070086956, -0.04407261312007904, -0.003227223176509142, 0.03247720003128052, 0.017585542052984238, -0.007362167816609144, 0.009763238951563835, 0.008303354494273663, -0.0...
722,137
pytest_socket
resolve_hostnames
null
def resolve_hostnames(hostname: str) -> typing.Set[str]: try: return { addr_struct[0] for *_, addr_struct in socket.getaddrinfo(hostname, None) } except socket.gaierror: return set()
(hostname: str) -> Set[str]
[ 0.005202753935009241, 0.004642796702682972, -0.013068612664937973, -0.029893791303038597, -0.04306822270154953, 0.019135553389787674, 0.028447601944208145, -0.026049043983221054, 0.06652470678091049, -0.022169023752212524, -0.024673400446772575, -0.01012332458049059, -0.03573145717382431, ...
722,139
pytest_socket
socket_allow_hosts
disable socket.socket.connect() to disable the Internet. useful in testing.
def socket_allow_hosts(allowed=None, allow_unix_socket=False): """disable socket.socket.connect() to disable the Internet. useful in testing.""" if isinstance(allowed, str): allowed = allowed.split(",") if not isinstance(allowed, list): return allowed_ip_hosts_by_host = normalize_allow...
(allowed=None, allow_unix_socket=False)
[ 0.013178679160773754, -0.02092721313238144, -0.01718958094716072, -0.01824740320444107, -0.04340589791536331, 0.021244559437036514, 0.006373368203639984, 0.006809718906879425, -0.015532329678535461, -0.01988702453672886, 0.01004047878086567, 0.0253347996622324, 0.012702660635113716, -0.046...
722,143
itables.javascript
JavascriptCode
A class that explicitly states that a string is a Javascript code
class JavascriptCode(str): """A class that explicitly states that a string is a Javascript code""" pass
null
[ -0.008659771643579006, -0.02728421427309513, 0.027448466047644615, -0.024875173345208168, 0.0051602753810584545, -0.027119960635900497, -0.017109666019678116, 0.033215563744306564, 0.04478625953197479, -0.05343690887093544, 0.023469898849725723, 0.06727064400911331, -0.009909918531775475, ...
722,144
itables.javascript
JavascriptFunction
A class that explicitly states that a string is a Javascript function
class JavascriptFunction(str): """A class that explicitly states that a string is a Javascript function""" def __init__(self, value): assert value.lstrip().startswith( "function" ), "A Javascript function is expected to start with 'function'"
(value)
[ -0.03307228162884712, 0.006827181205153465, 0.03378136456012726, -0.058108311146497726, 0.003674950683489442, -0.020236091688275337, 0.010672584176063538, 0.04759936034679413, 0.028108714148402214, -0.02909051813185215, -0.0014954344369471073, 0.08392614871263504, 0.008772609755396843, 0.0...
722,145
itables.javascript
__init__
null
def __init__(self, value): assert value.lstrip().startswith( "function" ), "A Javascript function is expected to start with 'function'"
(self, value)
[ -0.02537257969379425, 0.023428644984960556, 0.04070431366562843, -0.03705309331417084, -0.020369060337543488, -0.017224956303834915, 0.014097755774855614, 0.0503394678235054, 0.022127052769064903, -0.01710662990808487, -0.006609379779547453, 0.07187488675117493, 0.008443440310657024, 0.017...
722,148
itables.javascript
init_notebook_mode
Load the DataTables library and the corresponding css (if connected=False), and (if all_interactive=True), activate the DataTables representation for all the Pandas DataFrames and Series. Warning: make sure you keep the output of this cell when 'connected=False', otherwise the interactive tables will stop ...
def init_notebook_mode( all_interactive=False, connected=GOOGLE_COLAB, dt_bundle=None, ): """Load the DataTables library and the corresponding css (if connected=False), and (if all_interactive=True), activate the DataTables representation for all the Pandas DataFrames and Series. Warning: make ...
(all_interactive=False, connected=False, dt_bundle=None)
[ -0.020795131102204323, -0.05859784036874771, -0.03192107379436493, -0.029826993122696877, 0.0026631243526935577, 0.04993016645312309, -0.00019048736430704594, 0.005854321178048849, -0.07356596738100052, -0.011216988787055016, -0.027933215722441673, -0.004670710302889347, -0.06322302669286728...
722,151
itables.javascript
show
Show a dataframe
def show(df=None, caption=None, **kwargs): """Show a dataframe""" connected = kwargs.pop("connected", ("dt_url" in kwargs) or _CONNECTED) html = to_html_datatable(df, caption=caption, connected=connected, **kwargs) display(HTML(html))
(df=None, caption=None, **kwargs)
[ 0.01502242498099804, -0.03430120274424553, 0.012617047876119614, -0.03008061647415161, 0.03387198969721794, 0.028578374534845352, 0.012268313206732273, -0.0061967503279447556, -0.035535186529159546, -0.024447208270430565, -0.016900228336453438, -0.0201729703694582, -0.033013567328453064, -...
722,152
itables.javascript
to_html_datatable
null
def to_html_datatable( df=None, caption=None, tableId=None, connected=True, use_to_html=False, **kwargs, ): check_table_id(tableId) if "import_jquery" in kwargs: raise TypeError( "The argument 'import_jquery' was removed in ITables v2.0. " "Please pass a c...
(df=None, caption=None, tableId=None, connected=True, use_to_html=False, **kwargs)
[ 0.009043131954967976, -0.06929387897253036, -0.01238537672907114, -0.0824621170759201, -0.021759722381830215, 0.014282327145338058, -0.005510188173502684, 0.007211420685052872, -0.06463681161403656, -0.05443945154547691, -0.004386069253087044, -0.003447631374001503, -0.04649033024907112, -...
722,155
openap.drag
Drag
Compute the drag of aircraft.
class Drag(object): """Compute the drag of aircraft.""" def __init__(self, ac, wave_drag=False, **kwargs): """Initialize Drag object. Args: ac (string): ICAO aircraft type (for example: A320). wave_drag (bool): enable wave_drag model (experimental). """ ...
(ac, wave_drag=False, **kwargs)
[ 0.03306078910827637, -0.01429296750575304, -0.02576616406440735, 0.036023590713739395, -0.00032980332616716623, -0.03320382162928581, -0.06134022772312164, 0.0073508149944245815, -0.035900991410017014, -0.011963591910898685, -0.02425411343574524, 0.0069932350888848305, 0.01148341316729784, ...
722,156
openap.drag
__init__
Initialize Drag object. Args: ac (string): ICAO aircraft type (for example: A320). wave_drag (bool): enable wave_drag model (experimental).
def __init__(self, ac, wave_drag=False, **kwargs): """Initialize Drag object. Args: ac (string): ICAO aircraft type (for example: A320). wave_drag (bool): enable wave_drag model (experimental). """ if not hasattr(self, "np"): self.np = importlib.import_module("numpy") if not ...
(self, ac, wave_drag=False, **kwargs)
[ 0.02630849927663803, 0.011639242991805077, 0.002673941431567073, 0.03581584617495537, -0.01952272094786167, -0.03824711591005325, -0.060491401702165604, 0.030390851199626923, -0.04144041985273361, 0.005511176772415638, -0.008491294458508492, 0.05025830492377281, -0.026743950322270393, 0.03...
722,157
openap.drag
_calc_drag
null
"""OpenAP drag model.""" import glob import importlib import os import warnings import pandas as pd import yaml from . import prop from .extra import ndarrayconvert curr_path = os.path.dirname(os.path.realpath(__file__)) dir_dragpolar = curr_path + "/data/dragpolar/" file_synonym = curr_path + "/data/dragpolar/_syn...
(self, mass, tas, alt, cd0, k, path_angle)
[ 0.031659211963415146, -0.004102557431906462, -0.017001038417220116, 0.024997331202030182, -0.004624608438462019, -0.030946167185902596, -0.05728809908032417, 0.003050815314054489, -0.04229377582669258, -0.012926492840051651, -0.031068403273820877, 0.004336843732744455, 0.013272829353809357, ...
722,159
openap.drag
clean
Compute drag at clean configuration (considering compressibility). Args: mass (int or ndarray): Mass of the aircraft (unit: kg). tas (int or ndarray): True airspeed (unit: kt). alt (int or ndarray): Altitude (unit: ft). path_angle (float or ndarray): Path angle (...
"""OpenAP drag model.""" import glob import importlib import os import warnings import pandas as pd import yaml from . import prop from .extra import ndarrayconvert curr_path = os.path.dirname(os.path.realpath(__file__)) dir_dragpolar = curr_path + "/data/dragpolar/" file_synonym = curr_path + "/data/dragpolar/_syn...
(self, mass, tas, alt, path_angle=0)
[ 0.031659211963415146, -0.004102557431906462, -0.017001038417220116, 0.024997331202030182, -0.004624608438462019, -0.030946167185902596, -0.05728809908032417, 0.003050815314054489, -0.04229377582669258, -0.012926492840051651, -0.031068403273820877, 0.004336843732744455, 0.013272829353809357, ...
722,160
openap.drag
dragpolar
Find and construct the drag polar model. Returns: dict: drag polar model parameters.
def dragpolar(self): """Find and construct the drag polar model. Returns: dict: drag polar model parameters. """ polar_files = glob.glob(dir_dragpolar + "*.yml") ac_polar_available = [s[-8:-4].lower() for s in polar_files] if self.ac in ac_polar_available: ac = self.ac else: ...
(self)
[ 0.02568015642464161, -0.03286709636449814, 0.0007274583913385868, 0.023313725367188454, -0.01610049419105053, 0.0031552412547171116, -0.020842120051383972, 0.0007647077436558902, 0.01922944188117981, 0.012498260475695133, -0.017047066241502762, -0.009272903203964233, 0.00045110087376087904, ...
722,161
openap.drag
nonclean
Compute drag at at non-clean configuration. Args: mass (int or ndarray): Mass of the aircraft (unit: kg). tas (int or ndarray): True airspeed (unit: kt). alt (int or ndarray): Altitude (unit: ft). flap_angle (int or ndarray): flap deflection angle (unit: degree)....
"""OpenAP drag model.""" import glob import importlib import os import warnings import pandas as pd import yaml from . import prop from .extra import ndarrayconvert curr_path = os.path.dirname(os.path.realpath(__file__)) dir_dragpolar = curr_path + "/data/dragpolar/" file_synonym = curr_path + "/data/dragpolar/_syn...
(self, mass, tas, alt, flap_angle, path_angle=0, landing_gear=False)
[ 0.031659211963415146, -0.004102557431906462, -0.017001038417220116, 0.024997331202030182, -0.004624608438462019, -0.030946167185902596, -0.05728809908032417, 0.003050815314054489, -0.04229377582669258, -0.012926492840051651, -0.031068403273820877, 0.004336843732744455, 0.013272829353809357, ...
722,162
openap.emission
Emission
Emission model based on ICAO emmision databank.
class Emission(object): """Emission model based on ICAO emmision databank.""" def __init__(self, ac, eng=None, **kwargs): """Initialize Emission object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). ...
(ac, eng=None, **kwargs)
[ 0.03340556100010872, -0.05153419077396393, -0.03969965875148773, 0.002464678604155779, 0.0017466627759858966, -0.043753139674663544, -0.07068128138780594, -0.043264277279376984, -0.044079046696424484, -0.014635302126407623, 0.00875877495855093, -0.014472348615527153, 0.006828789599239826, ...
722,163
openap.emission
__init__
Initialize Emission object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). Leave empty to use the default engine specified by in the aircraft database.
def __init__(self, ac, eng=None, **kwargs): """Initialize Emission object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). Leave empty to use the default engine specified by in the aircraft database. """ ...
(self, ac, eng=None, **kwargs)
[ 0.0393601730465889, 0.0030059372074902058, -0.01705072820186615, -0.0006500979652628303, 0.012505055405199528, -0.05108978971838951, -0.01968008652329445, -0.022122271358966827, -0.028058385476469994, -0.022407490760087967, 0.008708082139492035, 0.05141066387295723, -0.03199796751141548, 0...
722,164
openap.emission
_fl2sl
Convert to sea-level equivalent
def _fl2sl(self, ffac, tas, alt): """Convert to sea-level equivalent""" M = self.aero.tas2mach(tas * self.aero.kts, alt * self.aero.ft) beta = self.np.exp(0.2 * (M ** 2)) theta = (self.aero.temperature(alt * self.aero.ft) / 288.15) / beta delta = (1 - 0.0019812 * alt / 288.15) ** 5.255876 / self.np....
(self, ffac, tas, alt)
[ -0.013660362921655178, 0.011595847085118294, 0.04059910774230957, 0.007294015493243933, -0.01849878765642643, -0.013978679664433002, -0.02615659311413765, -0.057551782578229904, -0.06049849092960358, 0.042636338621377945, -0.008212587796151638, -0.03237742558121681, -0.006830181460827589, ...
722,165
openap.emission
co
Compute CO emission with given fuel flow, speed, and altitude. Args: ffac (float or ndarray): Fuel flow for all engines (unit: kg/s). tas (float or ndarray): Speed (unit: kt). alt (int or ndarray): Aircraft altitude (unit: ft). Returns: float: CO emissio...
"""OpenAP FuelFlow model.""" import importlib from openap import prop from openap.extra import ndarrayconvert class Emission(object): """Emission model based on ICAO emmision databank.""" def __init__(self, ac, eng=None, **kwargs): """Initialize Emission object. Args: ac (string...
(self, ffac, tas, alt=0)
[ 0.03498595207929611, -0.047566309571266174, -0.02923261746764183, -0.007996934466063976, -0.012560099363327026, -0.039118632674217224, -0.06247636303305626, -0.06211171671748161, -0.05838420242071152, -0.009723947383463383, 0.008255226537585258, -0.035208795219659805, 0.010493759997189045, ...
722,166
openap.emission
co2
Compute CO2 emission with given fuel flow. Args: ffac (float or ndarray): Fuel flow for all engines (unit: kg/s). Returns: float: CO2 emission from all engines (unit: g/s).
"""OpenAP FuelFlow model.""" import importlib from openap import prop from openap.extra import ndarrayconvert class Emission(object): """Emission model based on ICAO emmision databank.""" def __init__(self, ac, eng=None, **kwargs): """Initialize Emission object. Args: ac (string...
(self, ffac)
[ 0.034948911517858505, -0.04761156067252159, -0.029255783185362816, -0.007982533425092697, -0.012591738253831863, -0.039061740040779114, -0.062482573091983795, -0.062036849558353424, -0.05830896645784378, -0.009724914096295834, 0.008256047032773495, -0.035232555121183395, 0.01047454308718443,...
722,167
openap.emission
h2o
Compute H2O emission with given fuel flow. Args: ffac (float or ndarray): Fuel flow for all engines (unit: kg/s). Returns: float: H2O emission from all engines (unit: g/s).
"""OpenAP FuelFlow model.""" import importlib from openap import prop from openap.extra import ndarrayconvert class Emission(object): """Emission model based on ICAO emmision databank.""" def __init__(self, ac, eng=None, **kwargs): """Initialize Emission object. Args: ac (string...
(self, ffac)
[ 0.03498595207929611, -0.047566309571266174, -0.02923261746764183, -0.007996934466063976, -0.012560099363327026, -0.039118632674217224, -0.06247636303305626, -0.06211171671748161, -0.05838420242071152, -0.009723947383463383, 0.008255226537585258, -0.035208795219659805, 0.010493759997189045, ...
722,168
openap.emission
hc
Compute HC emission with given fuel flow, speed, and altitude. Args: ffac (float or ndarray): Fuel flow for all engines (unit: kg/s). tas (float or ndarray): Speed (unit: kt). alt (int or ndarray): Aircraft altitude (unit: ft). Returns: float: HC emissio...
"""OpenAP FuelFlow model.""" import importlib from openap import prop from openap.extra import ndarrayconvert class Emission(object): """Emission model based on ICAO emmision databank.""" def __init__(self, ac, eng=None, **kwargs): """Initialize Emission object. Args: ac (string...
(self, ffac, tas, alt=0)
[ 0.034948911517858505, -0.04761156067252159, -0.029255783185362816, -0.007982533425092697, -0.012591738253831863, -0.039061740040779114, -0.062482573091983795, -0.062036849558353424, -0.05830896645784378, -0.009724914096295834, 0.008256047032773495, -0.035232555121183395, 0.01047454308718443,...
722,169
openap.emission
nox
Compute NOx emission with given fuel flow, speed, and altitude. Args: ffac (float or ndarray): Fuel flow for all engines (unit: kg/s). tas (float or ndarray): Speed (unit: kt). alt (int or ndarray): Aircraft altitude (unit: ft). Returns: float: NOx emiss...
"""OpenAP FuelFlow model.""" import importlib from openap import prop from openap.extra import ndarrayconvert class Emission(object): """Emission model based on ICAO emmision databank.""" def __init__(self, ac, eng=None, **kwargs): """Initialize Emission object. Args: ac (string...
(self, ffac, tas, alt=0)
[ 0.034985434263944626, -0.047565605491399765, -0.029211927205324173, -0.008032266981899738, -0.012600429356098175, -0.03907753527164459, -0.06247543916106224, -0.06211079657077789, -0.058423854410648346, -0.009728868491947651, 0.008255104534327984, -0.035228531807661057, 0.010463218204677105,...
722,170
openap.emission
soot
Compute soot emission with given fuel flow. Args: ffac (float or ndarray): Fuel flow for all engines (unit: kg/s). Returns: float: Soot emission from all engines (unit: g/s).
"""OpenAP FuelFlow model.""" import importlib from openap import prop from openap.extra import ndarrayconvert class Emission(object): """Emission model based on ICAO emmision databank.""" def __init__(self, ac, eng=None, **kwargs): """Initialize Emission object. Args: ac (string...
(self, ffac)
[ 0.034985434263944626, -0.047565605491399765, -0.029211927205324173, -0.008032266981899738, -0.012600429356098175, -0.03907753527164459, -0.06247543916106224, -0.06211079657077789, -0.058423854410648346, -0.009728868491947651, 0.008255104534327984, -0.035228531807661057, 0.010463218204677105,...
722,171
openap.emission
sox
Compute SOx emission with given fuel flow. Args: ffac (float or ndarray): Fuel flow for all engines (unit: kg/s). Returns: float: SOx emission from all engines (unit: g/s).
"""OpenAP FuelFlow model.""" import importlib from openap import prop from openap.extra import ndarrayconvert class Emission(object): """Emission model based on ICAO emmision databank.""" def __init__(self, ac, eng=None, **kwargs): """Initialize Emission object. Args: ac (string...
(self, ffac)
[ 0.034985434263944626, -0.047565605491399765, -0.029211927205324173, -0.008032266981899738, -0.012600429356098175, -0.03907753527164459, -0.06247543916106224, -0.06211079657077789, -0.058423854410648346, -0.009728868491947651, 0.008255104534327984, -0.035228531807661057, 0.010463218204677105,...
722,172
openap.phase
FlightPhase
Fuzzy logic flight phase identification.
class FlightPhase(object): """Fuzzy logic flight phase identification.""" def __init__(self): """Initialize of the FlightPhase object.""" super(FlightPhase, self).__init__() # logic states self.alt_range = np.arange(0, 40000, 1) self.roc_range = np.arange(-4000, 4000, 0...
()
[ 0.04640013724565506, -0.014611680991947651, -0.004335733596235514, 0.010286333039402962, -0.03167422115802765, -0.060731422156095505, -0.04239153116941452, -0.03441585600376129, -0.04394927993416786, -0.023947788402438164, -0.06014986336231232, 0.05072029307484627, 0.03208962082862854, 0.0...
722,173
openap.phase
__init__
Initialize of the FlightPhase object.
def __init__(self): """Initialize of the FlightPhase object.""" super(FlightPhase, self).__init__() # logic states self.alt_range = np.arange(0, 40000, 1) self.roc_range = np.arange(-4000, 4000, 0.1) self.spd_range = np.arange(0, 600, 1) self.states = np.arange(0, 6, 0.01) self.alt_gnd =...
(self)
[ 0.04665512964129448, -0.011370856314897537, -0.017744217067956924, 0.008312885649502277, -0.0535433292388916, -0.06646758317947388, -0.04100964590907097, -0.02235114574432373, -0.08429168909788132, 0.008175299502909184, -0.052868712693452835, 0.06415968388319016, -0.010145893320441246, 0.0...
722,174
openap.phase
_get_cl
null
def _get_cl(self): labels = np.array(self.phaselabel()) if "CL" not in labels: return None idx = np.where(np.array(labels) == "CL")[0] istart = idx[0] iend = idx[-1] return istart, iend
(self)
[ 0.01422116905450821, -0.009367236867547035, -0.006301595829427242, 0.024252628907561302, -0.023963095620274544, 0.00678698904812336, 0.054772790521383286, 0.007463984657078981, 0.04635930806398392, -0.06046125665307045, -0.030383910983800888, -0.053750909864902496, -0.015260080806910992, -...
722,175
openap.phase
_get_cr
null
def _get_cr(self): # CR start = CL end, CR end = DE start ttCL = self._get_cl() if not ttCL: return None ttDE = self._get_de() if not ttDE: return None ttDE = ttDE[0:2] istart = ttCL[-1] iend = ttDE[0] if iend - istart < 200: # too few samples return N...
(self)
[ 0.00866581592708826, -0.008919554762542248, -0.010424782522022724, 0.03860266134142876, 0.0040533654391765594, -0.008386272937059402, 0.03005296364426613, -0.011001070030033588, 0.05277761444449425, -0.05625254288315773, 0.00278897350654006, -0.0017213363898918033, -0.00819704495370388, 0....
722,176
openap.phase
_get_de
null
def _get_de(self): labels = np.array(self.phaselabel()) if "DE" not in labels: return None idx = np.where(np.array(labels) == "DE")[0] istart = idx[0] iend = idx[-1] if "LVL" in labels[istart:iend]: isCDA = False else: isCDA = True return istart, iend, isCDA
(self)
[ 0.059581272304058075, 0.052743494510650635, 0.011627785861492157, 0.0024617784656584263, -0.019836680963635445, -0.01587468758225441, 0.03361907973885536, -0.02455546148121357, 0.00510162441059947, -0.06367681920528412, -0.03438476845622063, -0.016302049160003662, -0.025659477338194847, -0...
722,177
openap.phase
_get_fa_ld
null
def _get_fa_ld(self): # get the approach + landing data chunk (h=0) istart = 0 iend = 0 for i in reversed(list(range(0, self.ndata))): if self.alt[i] < 1500: # ft istart = i else: break # keep only the chunk in landing deceleration states, break at taxing poi...
(self)
[ 0.022493014112114906, -0.0017689120722934604, -0.016110118478536606, 0.01645410805940628, -0.0018226603278890252, -0.019913101568818092, 0.017954278737306595, -0.059242431074380875, -0.06272053718566895, -0.01117006503045559, -0.017008310183882713, 0.011189175769686699, -0.042692773044109344...
722,178
openap.phase
_get_to_ic
null
def _get_to_ic(self): # get the data chunk up to certain ft istart = 0 iend = 0 for i in range(0, self.ndata): if self.alt[i] < 1500: # ft iend = i continue else: break # keep only the chunk in taking-off states, break at starting point spdtmp...
(self)
[ 0.02714134007692337, -0.03436867147684097, -0.034873805940151215, -0.010199859738349915, 0.021235136315226555, -0.04107143357396126, 0.040838293731212616, -0.04736620560288429, 0.007810178212821484, -0.03063843585550785, -0.010384428314864635, -0.020613430067896843, -0.03324182704091072, -...
722,179
openap.phase
flight_phase_indices
Get the indices of data, of which different flight phase start. Returns: dict: Indices for takeoff (TO), initial climb (IC), climb (CL), cruise (CR), descent (DE), final approach (FA), landing (LD).
def flight_phase_indices(self): """Get the indices of data, of which different flight phase start. Returns: dict: Indices for takeoff (TO), initial climb (IC), climb (CL), cruise (CR), descent (DE), final approach (FA), landing (LD). """ # Process the data and get the phase index ...
(self)
[ 0.0024993191473186016, 0.010494477115571499, -0.0934736505150795, 0.009766433387994766, -0.04506765305995941, -0.007910811342298985, -0.008780911564826965, 0.006499117705971003, -0.047944311052560806, -0.025126369670033455, -0.030737631022930145, -0.0029587855096906424, -0.02660021372139454,...
722,180
openap.phase
phaselabel
Fuzzy logic for determining phase label. Args: twindow (int): Time window in number of seconds. Default to 60. Returns: list: Labels could be: ground [GND], climb [CL], descent [DE], cruise [CR], leveling [LVL].
def phaselabel(self, twindow=60): """Fuzzy logic for determining phase label. Args: twindow (int): Time window in number of seconds. Default to 60. Returns: list: Labels could be: ground [GND], climb [CL], descent [DE], cruise [CR], leveling [LVL]. """ if self.ts is None:...
(self, twindow=60)
[ 0.029212459921836853, -0.023361841216683388, -0.014860163442790508, -0.009299028664827347, -0.024052539840340614, -0.03849625214934349, -0.027221623808145523, -0.02291492000222206, -0.006480372045189142, -0.03266594931483269, -0.07069496810436249, 0.030959518626332283, 0.03380357101559639, ...
722,181
openap.phase
plot_logics
Visualize fuzzy logic membership functions.
def plot_logics(self): """Visualize fuzzy logic membership functions.""" plt.figure(figsize=(10, 8)) plt.subplot(411) plt.plot(self.alt_range, self.alt_gnd, lw=2, label="Ground") plt.plot(self.alt_range, self.alt_lo, lw=2, label="Low") plt.plot(self.alt_range, self.alt_hi, lw=2, label="High") ...
(self)
[ 0.03358882665634155, -0.039007555693387985, 0.05046534165740013, 0.04740019887685776, -0.07082662731409073, -0.03537682443857193, -0.030852094292640686, -0.014979047700762749, -0.0367816798388958, 0.038752127438783646, -0.016119351610541344, 0.04572167247533798, 0.06473283469676971, 0.0178...
722,182
openap.phase
set_trajectory
Set trajectory data. Args: ts (list): Time (unit: second). alt (list): Altitude (unit: ft). spd (list): True airspeed (unit: kt). roc (list): Rate of climb (unit: ft/min). Negative for descent.
def set_trajectory(self, ts, alt, spd, roc): """Set trajectory data. Args: ts (list): Time (unit: second). alt (list): Altitude (unit: ft). spd (list): True airspeed (unit: kt). roc (list): Rate of climb (unit: ft/min). Negative for descent. """ self.ts = ts - ts[0] s...
(self, ts, alt, spd, roc)
[ -0.013638879172503948, 0.09190619736909866, -0.01742541417479515, -0.013684832490980625, -0.04771769791841507, -0.032442886382341385, -0.06312117725610733, 0.010964409448206425, 0.01968630775809288, 0.022278061136603355, -0.04337972402572632, 0.002103503094986081, 0.013519401662051678, -0....
722,183
openap.fuel
FuelFlow
Fuel flow model based on ICAO emission databank.
class FuelFlow(object): """Fuel flow model based on ICAO emission databank.""" def __init__(self, ac, eng=None, **kwargs): """Initialize FuelFlow object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). ...
(ac, eng=None, **kwargs)
[ 0.05831855162978172, -0.050640758126974106, -0.018592100590467453, 0.03146669641137123, -0.01916385069489479, -0.04855795204639435, -0.065097875893116, -0.03097662515938282, -0.08380229026079178, -0.021971555426716805, -0.00671806838363409, -0.026586398482322693, -0.008290382102131844, 0.0...
722,184
openap.fuel
__init__
Initialize FuelFlow object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). Leave empty to use the default engine specified by in the aircraft database. polydeg (int): Order of the...
def __init__(self, ac, eng=None, **kwargs): """Initialize FuelFlow object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). Leave empty to use the default engine specified by in the aircraft database. p...
(self, ac, eng=None, **kwargs)
[ 0.04939153790473938, -0.038122233003377914, -0.010460368357598782, 0.029977092519402504, -0.03780609741806984, -0.04314320906996727, -0.044630907475948334, -0.03680190071463585, -0.08517064899206161, -0.01963759958744049, 0.018661297857761383, -0.002619741251692176, -0.03656015172600746, 0...
722,185
openap.fuel
at_thrust
Compute the fuel flow at a given total thrust. Args: acthr (int or ndarray): The total net thrust of the aircraft (unit: N). alt (int or ndarray): Aircraft altitude (unit: ft). Returns: float: Fuel flow (unit: kg/s).
"""OpenAP FuelFlow model.""" import importlib from openap import prop from openap.extra import ndarrayconvert def func_fuel2(a, b): return lambda x: a * (x + b) ** 2
(self, acthr, alt=0, limit=True)
[ 0.02575569599866867, -0.07577159255743027, 0.033085454255342484, 0.0064620026387274265, -0.018001291900873184, -0.027214262634515762, -0.05734565481543541, -0.06550624221563339, -0.030666816979646683, -0.014521042816340923, 0.014428728260099888, -0.029392879456281662, 0.03747961297631264, ...
722,186
openap.fuel
enroute
Compute the fuel flow during climb, cruise, or descent. The net thrust is first estimated based on the dynamic equation. Then FuelFlow.at_thrust() is called to compted the thrust. Assuming no flap deflection and no landing gear extended. Args: mass (int or ndarray): Aircraf...
"""OpenAP FuelFlow model.""" import importlib from openap import prop from openap.extra import ndarrayconvert def func_fuel2(a, b): return lambda x: a * (x + b) ** 2
(self, mass, tas, alt, path_angle=0, limit=True)
[ 0.02575569599866867, -0.07577159255743027, 0.033085454255342484, 0.0064620026387274265, -0.018001291900873184, -0.027214262634515762, -0.05734565481543541, -0.06550624221563339, -0.030666816979646683, -0.014521042816340923, 0.014428728260099888, -0.029392879456281662, 0.03747961297631264, ...
722,187
openap.fuel
plot_model
Plot the engine fuel model, or return the pyplot object. Args: plot (bool): Display the plot or return an object. Returns: None or pyplot object.
def plot_model(self, plot=True): """Plot the engine fuel model, or return the pyplot object. Args: plot (bool): Display the plot or return an object. Returns: None or pyplot object. """ import matplotlib.pyplot as plt x = [0.07, 0.3, 0.85, 1.0] y = [ self.engine["ff_i...
(self, plot=True)
[ 0.11342854797840118, -0.055629368871450424, 0.013720289804041386, 0.026467908173799515, -0.003002190263941884, -0.006766618695110083, -0.04522925987839699, -0.024877963587641716, -0.038794659078121185, 0.008819518610835075, 0.0063878376968204975, -0.023512480780482292, 0.011943292804062366, ...
722,188
openap.fuel
takeoff
Compute the fuel flow at takeoff. The net thrust is first estimated based on the maximum thrust model and throttle setting. Then FuelFlow.at_thrust() is called to compted the thrust. Args: tas (int or ndarray): Aircraft true airspeed (unit: kt). alt (int or ndar...
"""OpenAP FuelFlow model.""" import importlib from openap import prop from openap.extra import ndarrayconvert def func_fuel2(a, b): return lambda x: a * (x + b) ** 2
(self, tas, alt=None, throttle=1)
[ 0.025829507037997246, -0.07577148079872131, 0.033085402101278305, 0.006475839763879776, -0.01796433888375759, -0.02726960927248001, -0.05730864405632019, -0.06550614535808563, -0.03074062243103981, -0.014502557925879955, 0.014456400647759438, -0.029374372214078903, 0.03740570694208145, 0.0...
722,189
openap.thrust
Thrust
Simplified two-shaft turbonfan model.
class Thrust(object): """Simplified two-shaft turbonfan model.""" def __init__(self, ac, eng=None, **kwargs): """Initialize Thrust object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). """ ...
(ac, eng=None, **kwargs)
[ -0.01929096132516861, -0.002909201430156827, -0.015930600464344025, 0.026841402053833008, -0.0009062084718607366, -0.05700168013572693, -0.07732979208230972, -0.0398472435772419, -0.08861396461725235, -0.023377327248454094, 0.003860785160213709, 0.040386561304330826, -0.003570383647456765, ...
722,190
openap.thrust
__init__
Initialize Thrust object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3).
def __init__(self, ac, eng=None, **kwargs): """Initialize Thrust object. Args: ac (string): ICAO aircraft type (for example: A320). eng (string): Engine type (for example: CFM56-5A3). """ if not hasattr(self, "np"): self.np = importlib.import_module("numpy") if not hasattr(se...
(self, ac, eng=None, **kwargs)
[ 0.01288728415966034, -0.0051413001492619514, -0.03116544708609581, 0.020746711641550064, -0.018250934779644012, -0.062403496354818344, -0.07986485958099365, -0.009502103552222252, -0.06937351822853088, -0.026046834886074066, 0.018577655777335167, 0.04962512105703354, -0.05724858492612839, ...
722,191
openap.thrust
_dfunc
null
def _dfunc(self, mratio): d = -0.4204 * mratio + 1.0824 return d
(self, mratio)
[ 0.01283914316445589, -0.00965355709195137, 0.06304292380809784, 0.052447766065597534, 0.01205594651401043, 0.0012418944388628006, 0.022369500249624252, -0.032014258205890656, -0.09686996787786484, 0.06209252402186394, 0.01198554690927267, 0.017221523448824883, 0.051426973193883896, 0.02891...
722,192
openap.thrust
_mfunc
null
def _mfunc(self, vratio, roc): m = -1.2043e-1 * vratio - 8.8889e-9 * roc**2 + 2.4444e-5 * roc + 4.7379e-1 return m
(self, vratio, roc)
[ 0.020328842103481293, 0.01908494345843792, 0.030120093375444412, 0.05842765048146248, 0.03054657205939293, -0.035753171890974045, -0.010972954332828522, -0.05657957121729851, -0.052172619849443436, 0.04463815689086914, -0.006170620676130056, 0.036748290061950684, 0.05835656821727753, 0.051...
722,193
openap.thrust
_nfunc
null
def _nfunc(self, roc): # n = self.np.where(roc<1500, 0.89, self.np.where(roc<2500, 0.93, 0.97)) n = 2.667e-05 * roc + 0.8633 return n
(self, roc)
[ -0.06991326063871384, 0.018797604367136955, 0.037158481776714325, 0.03337348252534866, 0.04632981866598129, 0.004940513055771589, -0.061906538903713226, -0.036066655069589615, 0.020762892439961433, -0.047421645373106, 0.013292982243001461, 0.01660485379397869, 0.060996681451797485, -0.0306...
722,194
openap.thrust
climb
Calculate thrust during the climb. Args: tas (float or ndarray): True airspeed (kt). alt (float or ndarray): Altitude(ft) roc (float or ndarray): Vertical rate (ft/min). Returns: float or ndarray: Total thrust (unit: N).
"""OpenAP thrust model. Simplified two-shaft turbonfan model base on: - M. Bartel, T. M. Young, Simplified Thrust and Fuel Consumption Models for Modern Two-Shaft Turbonfan Engines - C. Svoboda, Turbofan engine database as a preliminary desgin (cruise thrust) """ import importlib from openap import pr...
(self, tas, alt, roc)
[ -0.02900388278067112, -0.010782808996737003, -0.01144101470708847, 0.012104572728276253, 0.0010294505627825856, -0.06233159080147743, -0.07209230959415436, -0.0468343123793602, -0.08938761055469513, -0.026114197447896004, -0.0003678998036775738, 0.024230550974607468, 0.0043372041545808315, ...
722,195
openap.thrust
cruise
Calculate thrust at the cruise. Args: tas (float or ndarray): True airspeed (kt). alt (float or ndarray): Altitude (ft). Returns: float or ndarray: Total thrust (unit: N).
"""OpenAP thrust model. Simplified two-shaft turbonfan model base on: - M. Bartel, T. M. Young, Simplified Thrust and Fuel Consumption Models for Modern Two-Shaft Turbonfan Engines - C. Svoboda, Turbofan engine database as a preliminary desgin (cruise thrust) """ import importlib from openap import pr...
(self, tas, alt)
[ -0.029005305841565132, -0.010788689367473125, -0.011420170776546001, 0.012105166912078857, 0.001048900419846177, -0.062291838228702545, -0.07205303758382797, -0.04683661460876465, -0.08930637687444687, -0.026094073429703712, -0.00039099634159356356, 0.02425314486026764, 0.004356147721409798,...
722,196
openap.thrust
descent_idle
Idle thrust during the descent. Note: The idle thrust at the descent is taken as 7% of the maximum avaiable thrust. This may (likely) differ from actual idle thrust. Args: tas (float or ndarray): True airspeed (kt). alt (float or ndarray): Altitude(ft) Returns:...
def descent_idle(self, tas, alt): """Idle thrust during the descent. Note: The idle thrust at the descent is taken as 7% of the maximum avaiable thrust. This may (likely) differ from actual idle thrust. Args: tas (float or ndarray): True airspeed (kt). alt (float or ndarray): Altitude(ft...
(self, tas, alt)
[ -0.008280395530164242, 0.0062927184626460075, 0.09150960296392441, -0.035988423973321915, 0.01972387358546257, -0.060050785541534424, -0.023718340322375298, -0.07797810435295105, -0.060012560337781906, -0.00082720338832587, -0.015547840856015682, -0.026738081127405167, -0.031057456508278847,...
722,197
openap.thrust
takeoff
Calculate thrust at takeoff condition. Args: tas (float or ndarray): True airspeed (kt). alt (float or ndarray): Altitude of the runway (ft). Defaults to 0. Returns: float or ndarray: Total thrust (unit: N).
"""OpenAP thrust model. Simplified two-shaft turbonfan model base on: - M. Bartel, T. M. Young, Simplified Thrust and Fuel Consumption Models for Modern Two-Shaft Turbonfan Engines - C. Svoboda, Turbofan engine database as a preliminary desgin (cruise thrust) """ import importlib from openap import pr...
(self, tas, alt=None)
[ -0.02900388278067112, -0.010782808996737003, -0.01144101470708847, 0.012104572728276253, 0.0010294505627825856, -0.06233159080147743, -0.07209230959415436, -0.0468343123793602, -0.08938761055469513, -0.026114197447896004, -0.0003678998036775738, 0.024230550974607468, 0.0043372041545808315, ...
722,198
openap.kinematic
WRAP
Construct the kinematic model of the aicraft.
class WRAP(object): """Construct the kinematic model of the aicraft.""" def __init__(self, ac, **kwargs): """Initialize WRAP object. Args: ac (string): ICAO aircraft type (for example: A320). """ super(WRAP, self).__init__() self.ac = ac.lower() s...
(ac, **kwargs)
[ 0.05496084317564964, -0.03791225329041481, -0.045741092413663864, 0.01792287826538086, 0.009145238436758518, -0.0470922626554966, -0.061994876712560654, -0.051106035709381104, -0.00938864704221487, -0.03143458068370819, -0.06930709630250931, 0.01893625594675541, -0.026029901579022408, 0.01...
722,199
openap.kinematic
__init__
Initialize WRAP object. Args: ac (string): ICAO aircraft type (for example: A320).
def __init__(self, ac, **kwargs): """Initialize WRAP object. Args: ac (string): ICAO aircraft type (for example: A320). """ super(WRAP, self).__init__() self.ac = ac.lower() self.use_synonym = kwargs.get("use_synonym", False) wrap_files = glob.glob(dir_wrap + "*.txt") ac_wrap_ava...
(self, ac, **kwargs)
[ 0.03679367154836655, -0.021762222051620483, 0.011061560362577438, 0.02658022567629814, -0.0032706488855183125, -0.04760260507464409, -0.03024335205554962, 0.009663076139986515, 0.03181326389312744, -0.007150315213948488, -0.03246288374066353, 0.014093113131821156, -0.0182975884526968, 0.00...
722,200
openap.kinematic
_get_var
null
def _get_var(self, var): r = self.df[self.df["variable"] == var] if r.shape[0] == 0: raise RuntimeError("variable not found") v = r.values[0] res = { "default": v[3], "minimum": v[4], "maximum": v[5], "statmodel": v[6], "statmodel_params": [float(i) for i ...
(self, var)
[ 0.12189515680074692, 0.03488787263631821, 0.028959333896636963, -0.033188726752996445, 0.03512796759605408, 0.023529458791017532, 0.02698315493762493, -0.00876352284103632, 0.021091556176543236, -0.01268817763775587, -0.010102522559463978, 0.03145264461636543, -0.05673665553331375, -0.0727...
722,201
openap.kinematic
climb_const_mach
Get speed during constant Mach climb.
def climb_const_mach(self): """Get speed during constant Mach climb.""" return self._get_var("cl_v_mach_const")
(self)
[ 0.06194981932640076, -0.005386035423725843, -0.014196139760315418, 0.04178863763809204, 0.027725793421268463, -0.008872587233781815, -0.009414106607437134, -0.042421795427799225, -0.06144995614886284, -0.02679271437227726, -0.010713753290474415, 0.029108751565217972, 0.01612061634659767, 0...
722,202
openap.kinematic
climb_const_vcas
Get speed for constant CAS climb.
def climb_const_vcas(self): """Get speed for constant CAS climb.""" return self._get_var("cl_v_cas_const")
(self)
[ 0.0024237337056547403, -0.018760651350021362, -0.012427068315446377, 0.02088012546300888, 0.052556317299604416, 0.009794285520911217, -0.017336629331111908, -0.07192962616682053, 0.025450238958001137, -0.054245270788669586, -0.012402230873703957, 0.024489853531122208, -0.003655263688415289, ...
722,203
openap.kinematic
climb_cross_alt_concas
Get cross over altitude when constant CAS climb starts.
def climb_cross_alt_concas(self): """Get cross over altitude when constant CAS climb starts.""" return self._get_var("cl_h_cas_const")
(self)
[ -0.031195465475320816, 0.0034016782883554697, 0.028128447011113167, 0.05117344111204147, 0.051003992557525635, -0.01339490246027708, 0.017639586701989174, -0.07265950739383698, 0.027857329696416855, -0.060730334371328354, -0.006968568544834852, -0.008065748028457165, -0.021943578496575356, ...
722,204
openap.kinematic
climb_cross_alt_conmach
Get cross over altitude from constant CAS to Mach climb.
def climb_cross_alt_conmach(self): """Get cross over altitude from constant CAS to Mach climb.""" return self._get_var("cl_h_mach_const")
(self)
[ 0.025992676615715027, 0.0174130629748106, 0.033624641597270966, 0.055945176631212234, 0.02413122169673443, -0.03624759986996651, 0.01572929322719574, -0.07425512373447418, -0.01832686737179756, -0.03844750300049782, -0.019088372588157654, 0.010635675862431526, -0.007183522917330265, -0.012...
722,205
openap.kinematic
climb_range
Get climb range distance (in km).
def climb_range(self): """Get climb range distance (in km).""" return self._get_var("cl_d_range")
(self)
[ 0.01858689822256565, 0.023860866203904152, -0.01228885818272829, -0.00459125405177474, -0.018603965640068054, 0.0427037850022316, 0.015241597779095173, -0.0327361524105072, -0.014482078142464161, -0.022222353145480156, -0.06014713644981384, -0.01858689822256565, 0.0023959006648510695, 0.04...
722,206
openap.kinematic
climb_vs_concas
Get vertical rate during constant CAS climb.
def climb_vs_concas(self): """Get vertical rate during constant CAS climb.""" return self._get_var("cl_vs_avg_cas_const")
(self)
[ -0.006794804707169533, -0.038879990577697754, 0.015294578857719898, 0.03901371359825134, 0.05833670124411583, 0.014082713983952999, 0.007062251213937998, -0.06987031549215317, 0.029385650530457497, 0.0009240474901162088, -0.016238998621702194, -0.0173505712300539, 0.0025156657211482525, -0...
722,207
openap.kinematic
climb_vs_conmach
Get vertical rate during constant Mach climb.
def climb_vs_conmach(self): """Get vertical rate during constant Mach climb.""" return self._get_var("cl_vs_avg_mach_const")
(self)
[ 0.04180153086781502, -0.029394837096333504, 0.013894828967750072, 0.04738621413707733, 0.026468729600310326, -0.006224248092621565, 0.00377676822245121, -0.05624813959002495, -0.024980595335364342, 0.035982757806777954, -0.030699044466018677, -0.007152242120355368, 0.024060960859060287, -0...
722,208
openap.kinematic
climb_vs_pre_concas
Get vertical rate before constant CAS climb.
def climb_vs_pre_concas(self): """Get vertical rate before constant CAS climb.""" return self._get_var("cl_vs_avg_pre_cas")
(self)
[ -0.02288190834224224, -0.007150596007704735, 0.010273509658873081, 0.05016674846410751, 0.05813872441649437, 0.020396919921040535, 0.0234823077917099, -0.07478314638137817, 0.04583052545785904, 0.0026330037508159876, 0.0006921276799403131, -0.025350218638777733, -0.007300696335732937, -0.0...
722,209
openap.kinematic
cruise_alt
Get average cruise altitude.
def cruise_alt(self): """Get average cruise altitude.""" return self._get_var("cr_h_mean")
(self)
[ -0.005807104986160994, -0.01861664466559887, 0.06517521291971207, 0.05612121522426605, 0.04438832029700279, -0.042760636657476425, -0.010495176538825035, -0.06649770587682724, 0.018955746665596962, 0.005696896929293871, -0.011292063631117344, -0.013377535156905651, -0.014191376976668835, 0...
722,210
openap.kinematic
cruise_init_alt
Get initial crusie altitude.
def cruise_init_alt(self): """Get initial crusie altitude.""" return self._get_var("cr_h_init")
(self)
[ 0.005577621050179005, -0.00864205788820982, 0.061705417931079865, 0.04034985601902008, 0.00901100505143404, -0.04215553030371666, 0.013169262558221817, -0.02630380168557167, 0.016459409147500992, -0.016806652769446373, -0.0006310091121122241, 0.023716825991868973, -0.020348550751805305, 0....
722,211
openap.kinematic
cruise_mach
Get average crusie Mach number.
def cruise_mach(self): """Get average crusie Mach number.""" return self._get_var("cr_v_mach_mean")
(self)
[ 0.030866719782352448, 0.03133951500058174, 0.02971850521862507, 0.07659269124269485, 0.03329823538661003, -0.018101271241903305, -0.031407058238983154, -0.0394107922911644, 0.005188074428588152, 0.02164722979068756, -0.005610212218016386, 0.02154591679573059, 0.020059991627931595, 0.003887...
722,212
openap.kinematic
cruise_range
Get crusie range.
def cruise_range(self): """Get crusie range.""" return self._get_var("cr_d_range")
(self)
[ 0.0010678424732759595, 0.025820283219218254, -0.001244250452145934, 0.013402831740677357, -0.03296846151351929, 0.021260816603899002, -0.015732670202851295, -0.03570748120546341, 0.021127205342054367, -0.056149933487176895, -0.011757749132812023, 0.02106039971113205, 0.0022672079503536224, ...
722,213
openap.kinematic
descent_const_mach
Get speed during the constant Mach descent.
def descent_const_mach(self): """Get speed during the constant Mach descent.""" return self._get_var("de_v_mach_const")
(self)
[ 0.07999421656131744, 0.0017544412985444069, 0.016261283308267593, 0.028884954750537872, 0.03660865128040314, -0.014716544188559055, -0.012349605560302734, -0.06491225212812424, -0.10118869692087173, 0.0025932511780411005, 0.002008783398196101, 0.02599479816854, -0.004555318504571915, 0.006...
722,214
openap.kinematic
descent_const_vcas
Get speed during the constant CAS descent.
def descent_const_vcas(self): """Get speed during the constant CAS descent.""" return self._get_var("de_v_cas_const")
(self)
[ 0.018862029537558556, -0.024746054783463478, 0.017204558476805687, 0.007549784611910582, 0.0597684383392334, 0.008287359960377216, -0.015447637997567654, -0.09189024567604065, -0.007848129607737064, -0.015596810728311539, -0.010823291726410389, 0.011287383735179901, -0.014834373258054256, ...
722,215
openap.kinematic
descent_cross_alt_concas
Get crossover altitude from constant Mach to CAS descent.
def descent_cross_alt_concas(self): """Get crossover altitude from constant Mach to CAS descent.""" return self._get_var("de_h_cas_const")
(self)
[ -0.015142948366701603, 0.011470657773315907, 0.056504543870687485, 0.042487651109695435, 0.03583214804530144, -0.04574817419052124, 0.007546264212578535, -0.10373172163963318, 0.007760551292449236, -0.03154641017317772, -0.007315170019865036, -0.007558869197964668, -0.028470760211348534, -...
722,216
openap.kinematic
descent_cross_alt_conmach
Get crossover altitude from constant Mach to CAS descent.
def descent_cross_alt_conmach(self): """Get crossover altitude from constant Mach to CAS descent.""" return self._get_var("de_h_mach_const")
(self)
[ 0.02887927182018757, 0.016980407759547234, 0.05494105443358421, 0.05370001494884491, 0.019973991438746452, -0.05889895558357239, 0.009517413564026356, -0.09492257982492447, -0.04504629597067833, -0.009072988294064999, -0.011630531400442123, -0.0053876107558608055, -0.014942758716642857, -0...
722,217
openap.kinematic
descent_range
Get descent range.
def descent_range(self): """Get descent range.""" return self._get_var("de_d_range")
(self)
[ 0.03641067445278168, 0.012353622354567051, 0.009028596803545952, -0.005954593885689974, -0.005514274816960096, 0.020641494542360306, 0.004399074707180262, -0.08868928998708725, -0.03887975215911865, -0.04256691038608551, -0.019258810207247734, -0.014542871154844761, -0.050698406994342804, ...
722,218
openap.kinematic
descent_vs_concas
Get vertical rate during constant CAS descent.
def descent_vs_concas(self): """Get vertical rate during constant CAS descent.""" return self._get_var("de_vs_avg_cas_const")
(self)
[ 0.006168300751596689, -0.04406764358282089, 0.04667361453175545, 0.030286064371466637, 0.07296719402074814, -0.005353934597223997, 0.005391520913690329, -0.10036330670118332, 0.01667153462767601, 0.011117140762507915, -0.007362704258412123, -0.02273542992770672, -0.02846522629261017, -0.02...
722,219
openap.kinematic
descent_vs_conmach
Get vertical rate during constant Mach descent.
def descent_vs_conmach(self): """Get vertical rate during constant Mach descent.""" return self._get_var("de_vs_avg_mach_const")
(self)
[ 0.061912231147289276, -0.027728384360671043, 0.045255132019519806, 0.0398700051009655, 0.03702692687511444, -0.02324635349214077, -0.0010786977363750339, -0.08810200542211533, -0.04234515503048897, 0.05244645103812218, -0.018229154869914055, -0.013897639699280262, -0.007709762081503868, -0...