Python interface to rasdaman
Project description
RasdaPy - Talk RasQL using Python
Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann / rasdaman GmbH.
RasdaPy is a client side interface for Rasdaman that enables execution of RasQL queries using the python programming languae.
This directory contains the RasdaPy library.
Normally, this directory comes as part of the rasdaman package, available from:
The complete package includes the rasdaman source code. If you downloaded this package from PyPI or some other Python-specific source, you may have received only the Python part of the code. In this case, you will need to obtain the rasdaman database system from some other source before you can use this package locally.
Development Warning
The Python implementation of Protocol Buffers is not as mature as the C++ and Java implementations. It may be more buggy, and it is known to be pretty slow at this time. Since this library relies heavily on Protocol Buffers and GRPC, it might be prone to occasional hiccups and unexpected behaviour.
Installation
Make sure you have Python 2.6 or newer. Python 3.x and PyPy are not supported at the moment. If in doubt, run:
$ python --version
If you do not have setuptools, numpy, scipy, grpcio, and protobuf installed, note that they will be downloaded and installed automatically as soon as you run setup.py. If you would rather install them manually, you may do so by following the instructions on this page:
https://packaging.python.org/en/latest/installing.html#setup-for-installing-packages
Build the C++ code, or install a binary distribution of protoc. If you install a binary distribution, make sure that it is the same version as this package. If in doubt, run:
$ protoc --version
Build and run the tests:
$ python setup.py build $ python setup.py test
If some tests fail, this library may not work correctly on your system. Continue at your own risk.
Please note that there is a known problem with some versions of Python on Cygwin which causes the tests to fail after printing the error: “sem_init: Resource temporarily unavailable”. This appears to be a bug either in Cygwin or in Python: http://www.cygwin.com/ml/cygwin/2005-07/msg01378.html We do not know if or when it might me fixed. We also do not know how likely it is that this bug will affect users in practice.
Install:
$ python setup.py install
This step may require superuser privileges. In case the setup fails because of library issues, the dependencies for the library can be found in requirements.txt in project root.
Usage: For low level API
The complete documentation for RasdaPy can be found in Sphinx docs under the docs directory. Examples can be found in the examples directory.
Import RasdaPy
$ from raspy.rasda import *
Connect to default port 7001 if not specified
$ con = Connection(hostname="0.0.0.0", username="myuser", password="mypass", port=7000)
Open the database given a db name
$ db = con.database("dbname")
List of all the collections available
$ collection_list = db.collections $ print(collection_list)
Begin transaction
$ txn = db.transaction()
Get array data from rasdaman server using RasQL query
$ query = txn.query("select m[0:10 ,0:10] from mr as m") $ data = query.execute()
End transaction (commit or abort as preferred)
$ txn.abort() $ txn.commit()
Close the database connection
$ db.close()
Convert to Numpy Array
$ data = data.to_array()
Numpy Operations
$ data += 1
Usage: For Query Construction
Initialize RasCollection with collection name
$ col = RasCollection("rgb")
Perform operations as desired
$ col /= 3 $ col += 10 $ col = col.avg_cells() $ data = col.eval()
Add the associated database instance
$ col.use_db(db)
Get the data from db
$ arr = col.eval() $ data = col.to_array()
Convert array to image
$ arr.to_image("example.png")
Contributors
Siddharth Shukla
Thanks also to
Alex Mircea Dumitru
Vlad Merticariu
George Merticariu
Alex Toader
Peter Baumann
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for rasdapy-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b4592a354b1bf1cdb96dd1e9ae59161337b4cf396e49f6ccab0e2c8a6cfe946 |
|
MD5 | 3b8d24f21406e301bbcbb3440c2238c9 |
|
BLAKE2b-256 | d1a90c4ffe0a4eed939c3300fdeb272f66ffb30e01b865d58584eff4935c3cb8 |