sobester / adrpy Goto Github PK
View Code? Open in Web Editor NEWAircraft Design Recipes in Python
License: GNU General Public License v3.0
Aircraft Design Recipes in Python
License: GNU General Public License v3.0
There may be a file naming issue in the propulsion.py file near line 568. Following the online example, I executed the following commands
from ADRpy import propulsion as decks
import numpy as np
import matplotlib.pyplot as plt
piston = decks.PistonDeck("IO-540")
When calling the decks.PistonDeck("IO-540")
, I receive the following error
Traceback (most recent call last):
Cell In[54], line 6
piston = decks.PistonDeck("IO-540") # Selects data for the IO-540
File E:\anaconda3\lib\site-packages\ADRpy\propulsion.py:575 in __init__
spd_pwr = pd.DataFrame.to_numpy(power_df["Speed (RPM)"])
File E:\anaconda3\lib\site-packages\pandas\core\frame.py:1838 in to_numpy
result = self._mgr.as_array(dtype=dtype, copy=copy, na_value=na_value)
AttributeError: 'SingleBlockManager' object has no attribute 'as_array'
I initially thought it was my numpy and pandas version so I updated them to the most current revision available. That did not fix the issue. ADRpy was verified to be version 0.2.5.
I eventually traced the error back to the propulsion.py file where the __init__
function correctly assembles the folderpath to where the Piston_CSVs are saved, then the next line calls the following
data, self.data_available = _setup(engine_name, folderpath, ["power"], ["bsfc", "bsfc_best_power"])
I noticed there were no files named "power", "bsfc", or "bsfc_best_power"; however, there were files that ended in _data. I removed the _data filename extension (i.e., I changed "IO-540_power_data.csv" to "IO-540_power.csv"). The command successfully ran, but then the example code did not produce any plots from the code given in the example notebooks.
I then re-added the _data in the filename, and changed the variables in propulsion.py line 568 to be
data, self.data_available = _setup(engine_name, folderpath, ["IO-540_power_data"], ["IO-540_bsfc_data_data", "IO-540_bsfc_best_power_data"])
which successfully executed, but then the example code would not plot anything due to the power = piston.shaftpower(engine_speed, alt)
being empty. Here, engine_speed and alt were successfully created with the np.linspace command.
I think the entire problem traces back to the variable naming convention in either the csv files or the _setup function. With all variables and csv filenames back to their original names, the following print command produced the result
print(self.data_available)
[[True], [True, True], False, False]
Am I using the commands incorrectly or is there a code error and/or naming convention error? I would like to add my own engine models to the Piston_CSVs folder, but I need to get this running properly first.
Thank you for the help.
After installing Python and ADRpy on a new system I came across this warning.
The set_window_title() function was depreciated in Matplotlib 3.4 and will be removed two minor releases later. Use manager.set_window_title or GUI-specific methods instead.
fig.canvas.set_window_title("ADRpy constraintanalysis.py")
The warning disappears after changing the function as suggested
fig.canvas.manager.set_window_title()
I tried to plot the V-n diagram, as showed in the example in ADRpy, but these errors showed up:
`---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Input In [1], in <cell line: 1>()
----> 1 from ADRpy import airworthiness as aw
2 from ADRpy import unitconversions as co
3 from ADRpy import atmospheres as at
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\adrpy-0.2.5-py3.10.egg\ADRpy\airworthiness.py:20, in
17 import math
18 import warnings
---> 20 import numpy as np
21 from matplotlib import text as mpl_text
22 from matplotlib import pyplot as plt
ModuleNotFoundError: No module named 'numpy'
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [6], in <cell line: 1>()
----> 1 designatm = at.Atmosphere()
NameError: name 'at' is not defined
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 concept = aw.CertificationSpecifications(designbrief, designdef, designperf, designatm, designpropulsion, csbrief)
NameError: name 'aw' is not defined
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Input In [9], in <cell line: 1>()
----> 1 point=concept.flightenvelope(textsize=15, figsize_in=[15, 10], show=True)
NameError: name 'concept' is not defined`
currently get the error
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
in line 660 of atmospheres.py, the airspeed_mps, I think, is an array. for the boolean operation, if you add .any() it works
def mach(self, airspeed_mps, altitude_m=0):
"""Mach number at a given speed (m/s) and altitude (m)"""
# Airspeed may be negative, e.g., when simulating a tailwind, but Mach must be >0
if airspeed_mps.any() < 0:
negmsg = "Airspeed < 0. If intentional, ignore this. Positive Mach no. returned."
warnings.warn(negmsg, RuntimeWarning)
airspeed_mps = abs(airspeed_mps)
Hi there, I'm having an issue installing the ADRpy package on Jupyter.org, for a Notebook that has previously run for several months without issue. The error I'm getting is:
ValueError: Requested 'pygments>=2.17', but pygments==2.16.1 is already installed
Full output below:
ValueError Traceback (most recent call last)
Cell In[1], line 1
----> 1 await import("piplite").install(**{'requirements': ['ADRpy']})
File /lib/python3.11/site-packages/piplite/piplite.py:117, in _install(requirements, keep_going, deps, credentials, pre, index_urls, verbose)
115 """Invoke micropip.install with a patch to get data from local indexes"""
116 with patch("micropip.package_index.query_package", _query_package):
--> 117 return await micropip.install(
118 requirements=requirements,
119 keep_going=keep_going,
120 deps=deps,
121 credentials=credentials,
122 pre=pre,
123 index_urls=index_urls,
124 verbose=verbose,
125 )
File /lib/python3.11/site-packages/micropip/_commands/install.py:142, in install(requirements, keep_going, deps, credentials, pre, index_urls, verbose)
130 index_urls = package_index.INDEX_URLS[:]
132 transaction = Transaction(
133 ctx=ctx,
134 ctx_extras=[],
(...)
140 index_urls=index_urls,
141 )
--> 142 await transaction.gather_requirements(requirements)
144 if transaction.failed:
145 failed_requirements = ", ".join([f"'{req}'" for req in transaction.failed])
File /lib/python3.11/site-packages/micropip/transaction.py:204, in Transaction.gather_requirements(self, requirements)
201 for requirement in requirements:
202 requirement_promises.append(self.add_requirement(requirement))
--> 204 await asyncio.gather(*requirement_promises)
File /lib/python3.11/site-packages/micropip/transaction.py:211, in Transaction.add_requirement(self, req)
208 return await self.add_requirement_inner(req)
210 if not urlparse(req).path.endswith(".whl"):
--> 211 return await self.add_requirement_inner(Requirement(req))
213 # custom download location
214 wheel = WheelInfo.from_url(req)
File /lib/python3.11/site-packages/micropip/transaction.py:300, in Transaction.add_requirement_inner(self, req)
297 if self._add_requirement_from_pyodide_lock(req):
298 return
--> 300 await self._add_requirement_from_package_index(req)
301 else:
302 try:
File /lib/python3.11/site-packages/micropip/transaction.py:347, in Transaction._add_requirement_from_package_index(self, req)
344 if satisfied:
345 logger.info(f"Requirement already satisfied: {req} ({ver})")
--> 347 await self.add_wheel(wheel, req.extras, specifier=str(req.specifier))
File /lib/python3.11/site-packages/micropip/transaction.py:385, in Transaction.add_wheel(self, wheel, extras, specifier)
383 await wheel.download(self.fetch_kwargs)
384 if self.deps:
--> 385 await self.gather_requirements(wheel.requires(extras))
387 self.wheels.append(wheel)
File /lib/python3.11/site-packages/micropip/transaction.py:204, in Transaction.gather_requirements(self, requirements)
201 for requirement in requirements:
202 requirement_promises.append(self.add_requirement(requirement))
--> 204 await asyncio.gather(*requirement_promises)
File /lib/python3.11/site-packages/micropip/transaction.py:208, in Transaction.add_requirement(self, req)
206 async def add_requirement(self, req: str | Requirement) -> None:
207 if isinstance(req, Requirement):
--> 208 return await self.add_requirement_inner(req)
210 if not urlparse(req).path.endswith(".whl"):
211 return await self.add_requirement_inner(Requirement(req))
File /lib/python3.11/site-packages/micropip/transaction.py:300, in Transaction.add_requirement_inner(self, req)
297 if self._add_requirement_from_pyodide_lock(req):
298 return
--> 300 await self._add_requirement_from_package_index(req)
301 else:
302 try:
File /lib/python3.11/site-packages/micropip/transaction.py:347, in Transaction._add_requirement_from_package_index(self, req)
344 if satisfied:
345 logger.info(f"Requirement already satisfied: {req} ({ver})")
--> 347 await self.add_wheel(wheel, req.extras, specifier=str(req.specifier))
File /lib/python3.11/site-packages/micropip/transaction.py:385, in Transaction.add_wheel(self, wheel, extras, specifier)
383 await wheel.download(self.fetch_kwargs)
384 if self.deps:
--> 385 await self.gather_requirements(wheel.requires(extras))
387 self.wheels.append(wheel)
File /lib/python3.11/site-packages/micropip/transaction.py:204, in Transaction.gather_requirements(self, requirements)
201 for requirement in requirements:
202 requirement_promises.append(self.add_requirement(requirement))
--> 204 await asyncio.gather(*requirement_promises)
File /lib/python3.11/site-packages/micropip/transaction.py:208, in Transaction.add_requirement(self, req)
206 async def add_requirement(self, req: str | Requirement) -> None:
207 if isinstance(req, Requirement):
--> 208 return await self.add_requirement_inner(req)
210 if not urlparse(req).path.endswith(".whl"):
211 return await self.add_requirement_inner(Requirement(req))
File /lib/python3.11/site-packages/micropip/transaction.py:290, in Transaction.add_requirement_inner(self, req)
287 # Is some version of this package is already installed?
288 req.name = canonicalize_name(req.name)
--> 290 satisfied, ver = self.check_version_satisfied(req)
291 if satisfied:
292 logger.info(f"Requirement already satisfied: {req} ({ver})")
File /lib/python3.11/site-packages/micropip/transaction.py:235, in Transaction.check_version_satisfied(self, req)
231 if req.specifier.contains(ver, prereleases=True):
232 # installed version matches, nothing to do
233 return True, ver
--> 235 raise ValueError(
236 f"Requested '{req}', " f"but {req.name}=={ver} is already installed"
237 )
ValueError: Requested 'pygments>=2.17', but pygments==2.16.1 is already installed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.