Comments (8)
@agodemar there are multiple ways to install Python modules in general, e.g. pip install
etc.
But take a look at .travis.yml and note the -DINSTALL_PYTHON_MODULE=ON
- pip install cython numpy pandas scipy
- gem install gist
- mkdir build
- cd build
- cmake -DCMAKE_INSTALL_PREFIX=~/ -DINSTALL_PYTHON_MODULE=ON -DCPACK_GENERATOR=DEB -DBUILD_SHARED_LIBS=$USE_SYSTEM_EXPAT -DSYSTEM_EXPAT=$USE_SYSTEM_EXPAT ..
- make -j2
And take a look at jsbsim\python\CMakeLists.txt
# Install the JSBSim Python module
if (INSTALL_PYTHON_MODULE)
execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/findInstallDir.py OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/findModuleFileName.py OUTPUT_VARIABLE PYTHON_MODULE_NAME)
install(FILES ${CMAKE_BINARY_DIR}/tests/${PYTHON_MODULE_NAME} DESTINATION ${PYTHON_INSTALL_DIR} COMPONENT pymodules)
endif()
So in theory if you execute CMake with the arguments you see in .travis.yml
you should end up with the JSBSim python module installed.
from jsbsim.
@agodemar on Linux at least from what I've seen in terms of @bcoconni's commits he has things setup to allow a user to install the JSBSim python module etc. (although I'm not sure if this includes JSBSim_utils.py). So I would assume that once the user does the python install of the JSBSim module on Linux it would be available from any Jupyter notebook.
We'll need to look into the equivalent Python module install option on Windows.
For now as a very brief initial test on Windows with the JSBSim python module jsbsim.cp35-win_amd64.pyd
with Jupyter I've done the following:
Built all using CMake with VS2017 and then changed into the tests
directory where the python module/dll jsbsim.cp35-win_amd64.pyd
ends up.
cd \Users\Sean\CMakeBuilds\3f00c6d9-d323-5a32-8a90-665138817fd4\build\x64-Release\tests
jupyter notebook
Then created a new Jupyter notebook and sucessfully executed the following code in the notebook:
import jsbsim
fdm = jsbsim.FGFDMExec(root_dir='\\source\\jsbsim')
fdm['atmosphere/rho-slugs_ft3']
0.0023768988323037404
This works because the Python module/dll is in the same directory as the notebook.
from jsbsim.
@bcoconni is there a way for a Python script to retrieve the output from an <output>
element without having to read it in from a temporary .csv file or setup an output socket?
So for example I'm thinking of something along these lines from a Python script, inside and outside of a Jupyter notebook.
fdm.run('some script')
data_output = fdm.retreive_data_output()
# Use data_output, e.g. matplotlib the data etc.
from jsbsim.
@seanmcleod I'm working on Ubuntu (WLS on Windows 10). I've built all for Linux in jsbsim/build using CMake. What do you mean by "install the JSBSim python module"?
I feel a little dummy in these pythonic things, which I still do not handle easily.
EDIT
Forgot to configure cmake with -DINSTALL_PYTHON_MODULE=ON
Now
import jsbsim
works in Jupyter. Still, JSBSim_utils
is not found. @bcoconni Should it be?
from jsbsim.
@seanmcleod thanks for the instructions. Now the first Jupyter very basic test works.
from jsbsim.
Still,
JSBSim_utils
is not found. @bcoconni Should it be?
I did not plan to release JSBSim_utils.py
since it mostly contains stuff for the test suite (inheriting a test case, moving around files from source to build directory, etc.). So no, it is not installed by the installer.
If there are a couple of lines of general interest in there, I would rather move them in a separate file that would be located in the python
directory for instance and make JSBSim_utils.py
import that file.
from jsbsim.
@bcoconni @seanmcleod I've created a file jsbsim/doc/python/JSBSim_nb_utils.py
which can be called in the first cell of a Jupyter notebook. It defines utility functions and classes. Initially, they are copied from jsbsim/tests/JSBSim_utils.py
. In the future it will be cleaned up.
from jsbsim.
@seanmcleod I've closed this issue because it is resolved now. Regarding your question
@bcoconni is there a way for a Python script to retrieve the output from an element without having to read it in from a temporary .csv file or setup an output socket?
So for example I'm thinking of something along these lines from a Python script, inside and outside of a Jupyter notebook.
fdm.run('some script')
data_output = fdm.retreive_data_output()
... Use data_output, e.g. matplotlib the data etc.
please open a separate issue.
from jsbsim.
Related Issues (20)
- JSBSim Simulink Function HOT 36
- Rust HOT 13
- Can autopilot feature come to jsbsim- unreal engine 5? HOT 2
- MSVC: toupper is not a member of std HOT 1
- Missing target_include_directories in libJSBSim
- JSBSIM_ prefix in CMake options
- Cython warnings about 'tp_print' which is deprecated
- Wrong calculation of vPQRdot in FGAccelerations class HOT 4
- Fixing the mixture for JSBSim piston aircraft HOT 54
- Request: turbine spindown table or property support HOT 2
- Aircraft crashed on air when rolling consecutively HOT 15
- How Jsbsim models the "+" shaped tail fins of missiles and rockets. HOT 1
- JSBSimFlightDynamicsModel could not be loaded in Unreal Engine HOT 4
- AugmentCmd should be clamped to [0.0..1.0] HOT 5
- Trim succeeds and results in NaN values HOT 1
- JSBSim and s-function have different results and different reactivity themselves HOT 1
- Building for Unreal 5 on Linux not working HOT 7
- Javascript alternative? HOT 2
- Linearization and simplex trim from console executable and xml script HOT 16
- FGTurbine Shutdown Spin HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsbsim.