Git Product home page Git Product logo

goulib's Introduction

Goulib

library of useful Python code for scientific + technical applications

see the IPython notebook for an overview of features

License Version Build Tests Doc
author:

Philippe Guglielmetti [email protected]

installation:

"pip install Goulib"

distribution:

https://pypi.python.org/pypi/Goulib

documentation:

https://goulib.readthedocs.org/

notebook:https://mybinder.org/badge_logo.svg:target:https://mybinder.org/v2/gh/goulu/goulib/master?filepath=notebook.ipynb
source:

https://github.com/goulu/Goulib

Modules

colors
very simple RGB color management
container
sorted collection
datetime2
additions to datetime standard library
decorators
useful decorators
drawing
Read/Write and handle vector graphics in .dxf, .svg and .pdf formats
expr
simple symbolic math expressions
geom, geom3d
2D + 3D geometry
graph
efficient Euclidian Graphs for NetworkX and related algorithms
image
image processing and conversion
interval
operations on [x..y[ intervals
itertools2
additions to itertools standard library
markup
simple HTML/XML generation (forked from markup)
math2
additions to math standard library
motion
motion simulation (kinematics)
optim
optimization algorithms : knapsack, traveling salesman, simulated annealing
piecewise
piecewise-defined functions
plot
plotable rich object display on IPython notebooks
polynomial
manipulation of polynomials
stats
very basic statistics functions
table
Table class with Excel + CSV I/O, easy access to columns, HTML output, and much more.
tests
utilities for unit tests (using nose)
workdays
WorkCalendar class with datetime operations on working hours, handling holidays merges and improves BusinessHours and workdays packages

Requirements

Goulib uses lazy requirements. Many modules and functions do not require any other packages, packages listed in requirements.txt are needed only by some Goulib classes or functions

goulib's People

Contributors

goulu avatar marcnicole avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

goulib's Issues

A small advise

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!

GeoGraph to NetworkX

I tried to transform GeoGraph object result from graph.euclidean_minimum_spanning_tree to NetworkX but error has shown.

Euclidean Minimum Spanning Tree (EMST)

from Goulib import graph
points_emst = graph.euclidean_minimum_spanning_tree(points_array)
print(type(points_emst))

Convert GeoGraph to NetworkX object

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.

How to install Goulib on Anaconda for use in a Jupyter notebook

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

bug while reading dxf files

`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'

WARNING:root:unhandled entity type SPLINE

When attempting to draw a simple spline I get the message:
WARNING:root:unhandled entity type SPLINE

Circle and lines are normally plotted.

untitled-1 copy

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).

colors.csv not found

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?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40252630-colors-csv-not-found?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).

_repr_latex_ method not working anymore in Jupyter / IPython notebook

(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 !

new test framework

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:

  • dynamic generation of tests
  • xunit.xml output (for jenkins)

current contenders are nose2 and pytest.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.