AshleySetter / frange

Data type for efficiently storing large arrays of equally separated data in python, similar to range but for floats.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status codecov Documentation Status PyPI version

frange

Data type for efficiently storing large arrays of equally separated data in python, similar to range but for floats.

This is a simple package containing a class which can be used in a similar manner to the built-in range function in python. It can be used to create a generator or a numpy array containing the desired, equally seperated, values.

It generates numbers in the same manner as numpy's arange function.

Example usage

# you can create an frange object like so
>>> time = frange(0, 2, 1e-3)

# you can print the length of the array it will generate
>>> printlen(time) # prints length of frange, just like an array or list

# you can create a generator
>>> generator = time.get_generator() # gets a generator instance
>>> for i in generator: # iterates through printing each element
>>>     print(i)

# you can create a numpy array
>>> array = time.get_array() # gets an array instance
>>> newarray = 5 * array # multiplies array by 5

# you can also get the start, stop and step by accessing the slice parameters
>>> start = time.slice.start
>>> stop = time.slice.stop
>>> step = time.slice.step

About

Data type for efficiently storing large arrays of equally separated data in python, similar to range but for floats.

License:MIT License


Languages

Language:Python 99.1%Language:Shell 0.9%