Skip to content

Commit d93376d

Browse files
author
andrewtliew
committed
Merge remote-tracking branch 'origin/master'
2 parents e0e4296 + 20813c7 commit d93376d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2981
-2024
lines changed

README.md

Lines changed: 86 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,109 @@
11
# compas
22

3-
This is the main library of the compas framework.
4-
It consists of the following Python packages:
3+
This is the public repository of the main library of the **compas** framework.
4+
The **compas** framework is an open-source, Python-based framework for computational
5+
research and collaboration in architecture, engineering and digital fabrication.
56

6-
* compas
7-
* compas_rhino
8-
* compas_blender
9-
* compas_maya
10-
* compas_grasshopper
11-
* compas_dynamo
7+
The main library consists of a core package (**compas**) and several additional
8+
packages for integration of the core functionality in CAD software (**compas_blender**,
9+
**compas_maya** and **compas_rhino**). The core package defines all *real* functionality.
10+
The CAD packages simply provide a unified framework for processing, visualising,
11+
and interacting with datastructures, and for building user interfaces in different
12+
CAD software.
13+
14+
The complete documentation of the compas framework is available here: https://compas-dev.github.io/.
1215

13-
The complete documentation of the compas framework is available here:
14-
[compas-framework].
1516

1617
## Getting Started
1718

18-
To get started with the compas framework, first clone or download this repository. Then modify your `PYTHONPATH` to make the packages available from the location of the download path, or use the `setup.py` script to install them globally.
19+
**compas** does not yet have an installer or setup script. A detailed description
20+
of how to get started by cloning the repository and configuring your system
21+
is available through the documentation: https://compas-dev.github.io/gettingstarted.html
1922

20-
To modify your `PYTHONPATH` do something similar to the following:
23+
In short:
2124

22-
```
23-
$ echo "export PYTHONPATH=/path/to/packages:$PYTHONPATH" >> ~/.bash_profile
25+
* clone the repository
26+
* add the compas source folder to your ``PYTHONPATH``
27+
* verify your setup
28+
29+
For example, start Python from the command line, and try
30+
31+
```python
32+
>>> import compas
33+
>>> compas.verify()
2434
```
2535

26-
To run the stup script, and install the compas framework packages into the site packages folder of your Python installation, do:
36+
37+
This will produce something like the following:
2738

2839
```
29-
$ python setup.py install
40+
-------------------------------------------------------------------------------
41+
Checking required packages...
42+
43+
All required packages are installed!
44+
45+
Checking optional packages...
46+
47+
The following optional packages are not installed:
48+
- pycuda
49+
- pyopengl
50+
- pyside
51+
52+
-------------------------------------------------------------------------------
3053
```
3154

32-
For a complete overview of all installation instructions and options, and for further configuration possibilities, see the [Getting Started](https://compas-dev.github.io/gettingstarted.html) section of the main documentation website.
3355

3456
## Dependencies
3557

58+
**compas** has very few dependencies and most of them are included in a scientific
59+
Python distribution such as Anaconda or EPD.
60+
61+
| package | dependencies | exceptions
62+
| --------------------- | ------------------------ | --------------------------
63+
| compas.com | - | matlab (``MatlabEngine``, ``MatlabSession``), paramiko (``ssh``)
64+
| compas.datastructures | - |
65+
| compas.files | - |
66+
| compas.geometry | - | NumPy, SciPy (all functions with a ``_numpy`` suffix)
67+
| compas.hpc | Numba, PyCuda, PyOpenCL |
68+
| compas.interop | - |
69+
| compas.numerical | NumPy, SciPy |
70+
| compas.plotters | Matplotlib |
71+
| compas.topology | - | NumPy, SciPy (all functions with a ``_numpy`` suffix), planarity (``network_is_planar``), NetworkX (``network_embed_in_plane``)
72+
| compas.utilities | - | imageio (``gif_from_images``)
73+
| compas.viewers | PyOpenGL, PySide |
74+
75+
3676
## First Steps
3777

38-
## Examples
78+
Some useful resources for first explorations:
79+
80+
* https://compas-dev.github.io/main/examples.html
81+
* https://compas-dev.github.io/main/tutorial.html
82+
* https://compas-dev.github.io/main/reference.html
83+
84+
85+
## Questions and feedback
86+
87+
The **compas** framework has a forum: http://forum.compas-framework.org/
88+
for questions and discussions.
89+
90+
91+
## Issue tracker
92+
93+
If you find a bug, please [file a report](https://github.com/compas-dev/compas/issues).
94+
95+
96+
## License
97+
98+
The main library of **compas** is [released under the MIT license](https://compas-dev.github.io/license.html).
99+
100+
101+
## Contact
102+
103+
The **compas** framework is developed by the Block Research Group at ETH Zurich,
104+
with the support of the NCCR (National Centre for Competence in Research) in *Digital fabrication*.
105+
Main contributors are Tom Van Mele, Andrew Liew, Tomás Méndez and Matthias Rippmann.
39106

40-
## Attribution
107+
For questions, comments, requests, ..., please [contact the main developers directly](mailto:[email protected],[email protected],[email protected],[email protected]).
41108

42-
## Known Issues
43109

44-
[compas-framework]: https://compas-dev.github.io/
45-
[compas-main]: https://compas-dev.github.io/compas/index.html
46-
[compas-packages]: https://compas-dev.github.io/packages/index.html

src/compas/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ def verify():
145145
]
146146
current = installed()
147147

148-
print('Checking required packages...')
148+
print('=' * 80)
149+
print('Checking required packages...\n')
149150
issues = []
150151
for package in requirements:
151152
if package not in current:
@@ -157,7 +158,7 @@ def verify():
157158
else:
158159
print('All required packages are installed.')
159160

160-
print('\nChecking optional packages...')
161+
print('\nChecking optional packages...\n')
161162
issues = []
162163
for package in optional:
163164
if package not in current:
@@ -168,6 +169,7 @@ def verify():
168169
print('- {}'.format(package))
169170
else:
170171
print('All optional packages are installed.')
172+
print('=' * 80)
171173
print()
172174

173175

src/compas/com/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
88
.. module:: compas.com
99
10+
:mod:`compas.com` provides functionality for communicating with external software.
11+
1012
1113
Matlab
1214
======

src/compas/com/matlab_/client.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,6 @@
2323
class MatlabClient(object):
2424
"""Communicate with Matlab through Windows' COM interface.
2525
26-
Note
27-
----
28-
This implementation uses Windows' COM interface to communicate with Matlab.
29-
Therefore, it is obviously only available on Windows.
30-
When an instance of this class is created, it automatically connects to Matlab,
31-
and initializes a lease that keeps the interface alive for at least 5 minutes
32-
such that subsequent calls can be executed immediately.
33-
After every call, the lease is renewed...
34-
3526
Parameters
3627
----------
3728
verbose : bool
@@ -44,6 +35,15 @@ class MatlabClient(object):
4435
The name of the Matlab workspace.
4536
Default is ``'base'``.
4637
38+
Notes
39+
-----
40+
This implementation uses Windows' COM interface to communicate with Matlab.
41+
Therefore, it is obviously only available on Windows.
42+
When an instance of this class is created, it automatically connects to Matlab,
43+
and initializes a lease that keeps the interface alive for at least 5 minutes
44+
such that subsequent calls can be executed immediately.
45+
After every call, the lease is renewed...
46+
4747
Examples
4848
--------
4949
>>> matlab = MatlabClient(interactive=True)
@@ -61,9 +61,9 @@ class MatlabClient(object):
6161
6262
See Also
6363
--------
64-
* compas.com.mlab.MatlabEngine
65-
* compas.com.mlab.MatlabSession
66-
* compas.com.mlab.MatlabProcess
64+
compas.com.mlab.MatlabEngine
65+
compas.com.mlab.MatlabSession
66+
compas.com.mlab.MatlabProcess
6767
6868
"""
6969

src/compas/com/matlab_/engine.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def __init__(self, message=None):
2727

2828

2929
class MatlabEngine(object):
30-
"""Communicate with Matlab through the MATLAB engine [mathworks2017a]_, [mathworks2017b]_,
31-
[mathworks2017c]_, [mathworks2017d]_, [mathworks2017e]_.
30+
"""Communicate with Matlab through the MATLAB engine.
3231
3332
Attributes
3433
----------
@@ -38,6 +37,23 @@ class MatlabEngine(object):
3837
session_name : str
3938
The name of the current Matlab session.
4039
40+
Notes
41+
-----
42+
For more info, see [1]_, [2]_, [3]_, [4]_, [5]_.
43+
44+
References
45+
----------
46+
.. [1] MathWorks, 2017. *MATLAB APY for Python*.
47+
Available at: https://ch.mathworks.com/help/matlab/matlab-engine-for-python.html
48+
.. [2] MathWorks, 2017. *Pass Data to MATLAB from Python*.
49+
Available at: https://ch.mathworks.com/help/matlab/matlab_external/pass-data-to-matlab-from-python.
50+
.. [3] MathWorks, 2017. *Use MATLAB Arrays in Python*.
51+
Available at: https://ch.mathworks.com/help/matlab/matlab_external/use-matlab-arrays-in-python.html
52+
.. [4] MathWorks, 2017. *Use MATLAB Engine Workspace in Python*.
53+
Available at: https://ch.mathworks.com/help/matlab/matlab_external/use-the-matlab-engine-workspace-in-python.html
54+
.. [5] MathWorks, 2017. *Call MATLAB Functions from Python*.
55+
Available at: https://ch.mathworks.com/help/matlab/matlab_external/call-matlab-functions-from-python.html
56+
4157
Examples
4258
--------
4359
>>> matlab = MatlabEngine()

src/compas/com/matlab_/process.py

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,37 @@ def __init__(self, message=None):
3535
class MatlabProcess(object):
3636
"""Communicate with Matlab through a subprocess.
3737
38-
Parameters:
39-
matlab_exec (str, optional) : Path to the Matlab executable.
40-
Defaults to `matlab`.
41-
ws_data (dict, optional) : Workspace data to be loaded at startup.
42-
Defaults to an empty dict.
43-
ws_filename (str, optional) : Filename for workspace storage.
44-
Defaults to `'./workspace.mat'`.
45-
46-
Examples:
47-
>>> m = MatlabProcess()
48-
49-
>>> m.start()
50-
>>> m.write_value('a', 37)
51-
>>> m.run_command('tf = isprime(a);')
52-
>>> m.read_workspace()
53-
>>> m.stop()
54-
>>> print(m.ws_data)
55-
56-
>>> m.write_value('a', 17)
57-
>>> m.run_command('res = isprime(a);')
58-
>>> m.read_value('res')
59-
True
60-
61-
>>> m.run_command('res = isprime(a);', ivars={'a': 17})
62-
>>> m.read_value('res')
63-
True
64-
65-
>>> m.run_command('res = isprime(a);', ivars={'a': 17}, ovars={'res': None})
66-
{'res': True}
38+
Parameters
39+
----------
40+
matlab_exec : str, optional
41+
Path to the Matlab executable. Defaults to ``matlab``.
42+
ws_data : dict, optional
43+
Workspace data to be loaded at startup. Defaults to an empty dict.
44+
ws_filename : str, optional
45+
Filename for workspace storage. Defaults to ``'./workspace.mat'``.
46+
47+
Examples
48+
--------
49+
>>> m = MatlabProcess()
50+
51+
>>> m.start()
52+
>>> m.write_value('a', 37)
53+
>>> m.run_command('tf = isprime(a);')
54+
>>> m.read_workspace()
55+
>>> m.stop()
56+
>>> print(m.ws_data)
57+
58+
>>> m.write_value('a', 17)
59+
>>> m.run_command('res = isprime(a);')
60+
>>> m.read_value('res')
61+
True
62+
63+
>>> m.run_command('res = isprime(a);', ivars={'a': 17})
64+
>>> m.read_value('res')
65+
True
66+
67+
>>> m.run_command('res = isprime(a);', ivars={'a': 17}, ovars={'res': None})
68+
{'res': True}
6769
6870
"""
6971

src/compas/com/matlab_/session.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,39 @@ def __init__(self, message=None):
2424
class MatlabSession(object):
2525
"""Communicate with Matlab through a shared session.
2626
27+
Parameters
28+
----------
29+
name : str
30+
Name of a running Matlab session.
31+
32+
Notes
33+
-----
2734
Note that the Matlab engine for Python is only available since R2014b.
2835
For earlier versions of Matlab, use ``MatlabProcess`` instead.
2936
30-
For more information,
31-
see `Connect Python to Running MATLAB Session <https://ch.mathworks.com/help/matlab/matlab_external/connect-python-to-running-matlab-session.html>`_
37+
For more information, see [1]_
38+
39+
References
40+
----------
41+
.. [1] MathWorks, 2017. *Connect Python to Running MATLAB Session*.
42+
Available at https://ch.mathworks.com/help/matlab/matlab_external/connect-python-to-running-matlab-session.html
3243
33-
Examples:
34-
>>> m = MatlabSession()
35-
>>> m.session_name
36-
'MATLAB_13404'
37-
>>> m.isprime(37)
38-
True
44+
Examples
45+
--------
46+
>>> m = MatlabSession()
47+
>>> m.session_name
48+
'MATLAB_13404'
49+
>>> m.isprime(37)
50+
True
3951
40-
.. code-block:: python
52+
.. code-block:: python
4153
42-
# execute `matlab -nosplash -r "matlab.engine.shareEngine('MATLAB_xxx')"`
43-
# to connect to an existing named session
54+
# execute `matlab -nosplash -r "matlab.engine.shareEngine('MATLAB_xxx')"`
55+
# to connect to an existing named session
4456
45-
>>> m = MatlabSession('MATLAB_xxx')
46-
>>> m.isprime(37)
47-
True
57+
>>> m = MatlabSession('MATLAB_xxx')
58+
>>> m.isprime(37)
59+
True
4860
4961
"""
5062

src/compas/com/rhino/client.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,16 @@ class RhinoClientError(Exception):
2929
class RhinoClient(object):
3030
"""Communicate with Rhino through Window's COM interface.
3131
32-
Warning:
33-
This only works on Windows!
34-
35-
Parameters:
36-
delay_start (bool, optional) : Delay the creation of a COM interface.
37-
Default is ``False``.
38-
39-
Examples:
40-
>>> r = RhinoApp()
41-
>>> r.AddPoint(0, 0, 0)
42-
<guid>
32+
Parameters
33+
----------
34+
delay_start : bool, optional
35+
Delay the creation of a COM interface. Default is ``False``.
36+
37+
Examples
38+
--------
39+
>>> r = RhinoApp()
40+
>>> r.AddPoint(0, 0, 0)
41+
<guid>
4342
4443
"""
4544

0 commit comments

Comments
 (0)