Coverage for D:\Ralf Gerlich\git\modypy\modypy\utils\uiuc_db.py : 0%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""
2Utilities for loading measurement data from the UIUC aeronautical databases.
3"""
4import urllib.parse as parse
5import urllib.request as request
7import numpy as np
8from scipy.interpolate import interp1d
10UIUC_PROP_DB = "https://m-selig.ae.illinois.edu/props/"
13def load_static_propeller(path,
14 urlopen_options=None,
15 interp_options=None):
16 """Retrieve data about the static performance of a given propeller and
17 provide interpolation functions for the thrust and power coefficient.
19 Args:
20 path: The relative path of the respective input file, e.g.
21 `volume-2/data/apcff_4.2x4_static_0615rd.txt`
22 urlopen_options: Dictionary of options passed to `urllib.request.urlopen`
23 (Default value = None)
24 interp_options: Dictionary of options passed to
25 `scipy.interpolate.interp1d` (Default value = None)
27 Returns:
28 Functions for determining the thrust- and power-coefficient based on the
29 speed (in 1/s)
30 """
32 urlopen_options = urlopen_options or {}
33 interp_options = interp_options or {}
35 full_url = parse.urljoin(UIUC_PROP_DB, path)
37 with request.urlopen(full_url, **urlopen_options) as req:
38 data = np.loadtxt(req, skiprows=1)
39 speed = data[:, 0] / 60
40 thrust_coeff = data[:, 1]
41 power_coeff = data[:, 2]
43 return interp1d(speed, thrust_coeff, **interp_options), \
44 interp1d(speed, power_coeff, **interp_options)