goulu / goulib Goto Github PK
View Code? Open in Web Editor NEWlibrary of useful Python code for scientific + technical applications
License: GNU Lesser General Public License v3.0
library of useful Python code for scientific + technical applications
License: GNU Lesser General Public License v3.0
(posted on http://stackoverflow.com/questions/33150125/repr-latex-method-not-working-anymore-in-jupyter-ipython-notebook )
I have an Expr class to represent mathematical expressions in which I defined
def _latex(self):
""":return: string LaTex formula"""
(...)
return res
def _repr_latex_(self):
return r'$%s$'%self._latex() #tried several variations of this...
@property
def latex(self):
from IPython.display import Math
return Math(self._latex())
as you can see on http://nbviewer.ipython.org/github/Goulu/Goulib/blob/master/notebook.ipynb at cell [42], latex is correctly rendered when explicitly specified by the property but fails next cell when called though repr_latex with a UnicodeDecodeError.
e2(e1)._latex() returns '\sin(3x+2)' with no unicode, so what's wrong here ? Thanks !
I tried to transform GeoGraph object result from graph.euclidean_minimum_spanning_tree to NetworkX but error has shown.
from Goulib import graph
points_emst = graph.euclidean_minimum_spanning_tree(points_array)
print(type(points_emst))
graph.to_networkx_graph(points_emst, create_using='Geograph')
I found error "Input is not a correct NetworkX graph" when converting
Is there something I miss? Thanks in advance.
When attempting to draw a simple spline I get the message:
WARNING:root:unhandled entity type SPLINE
Circle and lines are normally plotted.
Line used: Drawing("C:/Users/User1/Desktop/Draw1.DXF").
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40458249-warning-root-unhandled-entity-type-spline?utm_campaign=plugin&utm_content=tracker%2F876436&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F876436&utm_medium=issues&utm_source=github).Goulib currently uses nose, via the tests.py module. Nose seems outdated, not maintained anymore.
Need to change for a more up-to-date package that has to provide:
current contenders are nose2 and pytest.
When attempting to import the Drawing
class, I get the following:
Traceback (most recent call last):
File "./cad_parser", line 31, in <module>
from Goulib.drawing import Drawing as gl_draw
File "/usr/local/lib/python2.7/dist-packages/Goulib/drawing.py", line 29, in <module>
from .colors import color_to_aci, aci_to_color
File "/usr/local/lib/python2.7/dist-packages/Goulib/colors.py", line 289, in <module>
table=Table(path+'/colors.csv')
File "/usr/local/lib/python2.7/dist-packages/Goulib/table.py", line 243, in __init__
self.load(filename,**kwargs)
File "/usr/local/lib/python2.7/dist-packages/Goulib/table.py", line 330, in load
self.read_csv(filename,**kwargs)
File "/usr/local/lib/python2.7/dist-packages/Goulib/table.py", line 428, in read_csv
for i,row in enumerate(reader):
File "/usr/local/lib/python2.7/dist-packages/Goulib/table.py", line 415, in csv_reader2
with codecs.open(filename, 'rb', errors=errors) as f:
File "/usr/lib/python2.7/codecs.py", line 878, in open
file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/Goulib/colors.csv'
The package was installed using pip
. I've checked the folder, and colors.csv is not present. Possibly it isn't specified in the install directives?
Hi Phillipe,
I followed your presentation at the Microclub yesterday and I wanted to play with your notebook “python_finesses.ipynb”.
The problem I face is that this notebook requires Goulib which is not yet installed on my computer. I saw that you provide a pip installation of it, but sudo pip install Goulib
raised an error on my Anaconda distribution (ModuleNotFoundError: No module named 'pip.req'). That is probably normal as on Anaconda I am supposed to use conda
and not pip
.
So the question is how to install Goulib on Anaconda for use in a Jupyter notebook.
By the way thank you for your presentation!
Nicolas
just found that several functions from .itertools2 exist in https://github.com/erikrose/more-itertools/ ...
check if/how to merge
Hello!
I noticed that the 'subdict' method in file Goulib/itertools2.py quoted a stack overflow answer, where a comment proposed that dict((k,bigdict.get(k,defaultVal) for k in wanted_keys) is better than dict([(i, d[i]) for i in keys if i in d]). (the url is here ) The original answer adopted it and modified the code.
I think it may help improve your code.
Have a nice day!
Hi, I was trying to read your dxf2img
method, and when I visit your Ipython Notebook for basic info
http://nbviewer.ipython.org/github/Goulu/Goulib/blob/master/notebook.ipynb
I found its unavailable, could you fix it?
Thank you!
`from Goulib.drawing import *
d = Drawing("house design.dxf")`
Results in error
/.local/lib/python3.6/site-packages/Goulib/drawing.py in from_dxf(self, dxf, layers, only, ignore, trans, flatten)
682 t2 = trans*Trans(e.scale[:2], e.insert[:2], e.rotation)
683 if flatten:
--> 684 self.from_dxf(self.block[e.name].dxf, layers=None, ignore=ignore, only=None, trans=t2, flatten=flatten)
685 else:
686 self.append(Instance.from_dxf(e, self.block, t2))
AttributeError: 'Group' object has no attribute 'block'
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.