Skip to content

Commit

Permalink
remove pandas dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan committed Sep 14, 2016
1 parent 280fce3 commit 0577158
Show file tree
Hide file tree
Showing 34 changed files with 508 additions and 1,659 deletions.
30 changes: 0 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,12 @@ python:
- 3.3
- 3.4

before_install:
- sudo apt-get update -qq
- sudo apt-get install libblas-dev liblapack-dev gfortran
- pip list

install:
- sudo apt-get update
# You may want to periodically update this, although the conda update
# conda line below will keep everything up-to-date. We do this
# conditionally because it saves us some downloading if the version is
# the same.
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget http://repo.continuum.io/miniconda/Miniconda-3.4.2-Linux-x86_64.sh -O miniconda.sh;
else
wget http://repo.continuum.io/miniconda/Miniconda3-3.4.2-Linux-x86_64.sh -O miniconda.sh;
fi
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a

# Replace dep1 dep2 ... with your dependencies
- deps='pip numpy pandas scipy cython pytz shapely requests nose mock coverage sphinx'
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION $deps
- source activate test-environment

# install deps
- pip install -r requirements.txt
- pip install fastcluster
- pip install twisted
- pip install geographiclib
- pip install python-coveralls
- python setup.py build_ext --inplace
- pip list

script:
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,5 @@ or build a debian package by entering
The following software has to be installed manually, depending on their availability as debian/ubuntu packages.

Requires numpy >= 1.7 and pandas >= 0.9 to have a finally usable 64 bit timestamp support.

Scipy and fastcluster is required for the (optional) clustering

4 changes: 0 additions & 4 deletions blitzortung/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ class Error(Exception):

'builder.Strike', 'builder.Station',

'calc.ObjectCache'

'calc.ThreePointSolution', 'calc.ThreePointSolver',

'data.TimeIntervals', 'data.Timestamp', 'data.NanosecondTimestamp', # data items

'db.strike', 'db.station', 'db.stationOffline', 'db.location', # database access
Expand Down
1 change: 0 additions & 1 deletion blitzortung/builder/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .base import Timestamp, Event, BuilderError
from .strike import Strike
from .strike_cluster import StrikeCluster
from .station import Station, StationOffline
from .raw_signal import RawWaveformEvent, ChannelWaveform
34 changes: 4 additions & 30 deletions blitzortung/builder/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
"""

import datetime

import pytz
import numpy as np
import pandas as pd

from .. import data, Error


Expand All @@ -36,36 +30,19 @@ class Base(object):


class Timestamp(Base):
timestamp_string_minimal_fractional_seconds_length = 20
timestamp_string_microseconds_length = 26

def __init__(self):
super(Timestamp, self).__init__()
self.timestamp = None

def set_timestamp(self, timestamp, nanoseconds=0):
def set_timestamp(self, timestamp, nanosecond=0):
if not timestamp:
self.timestamp = None
elif type(timestamp) == pd.Timestamp:
if nanoseconds:
self.timestamp = pd.Timestamp(timestamp.value + nanoseconds, tz=timestamp.tzinfo)
else:
self.timestamp = timestamp
elif type(timestamp) == datetime.datetime:
total_nanoseconds = pd.Timestamp(timestamp).value + nanoseconds
self.timestamp = pd.Timestamp(total_nanoseconds, tz=timestamp.tzinfo)
elif type(timestamp) == data.Timestamp:
self.timestamp = timestamp + nanosecond
else:
self.timestamp = self.__parse_timestamp(timestamp)
self.timestamp = data.Timestamp(timestamp, nanosecond=nanosecond)
return self

@staticmethod
def __parse_timestamp(timestamp_string):
try:
timestamp = np.datetime64(timestamp_string + 'Z', 'ns')
return pd.Timestamp(timestamp, tz=pytz.UTC)
except ValueError:
return pd.NaT

def build(self):
return self.timestamp

Expand All @@ -86,6 +63,3 @@ def set_y(self, y_coord):

def build(self):
return data.Event(self.timestamp, self.x_coord, self.y_coord)



5 changes: 2 additions & 3 deletions blitzortung/builder/raw_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import itertools
import datetime
from injector import inject
import numpy as np

from ..util import next_element
from .base import Event, BuilderError
Expand Down Expand Up @@ -63,7 +62,7 @@ def from_field_iterator(self, field):

def __extract_waveform_from_hex_string(self, waveform_hex_string):
hex_character = iter(waveform_hex_string)
self.waveform = np.zeros(self.values)
self.waveform = self.values * [0]
bits_per_char = 4
if self.bits == 0:
self.bits = len(waveform_hex_string) // self.values * bits_per_char
Expand Down Expand Up @@ -132,7 +131,7 @@ def from_string(self, string):
try:
field = iter(string.split(' '))
self.set_timestamp(next_element(field) + ' ' + next_element(field))
self.timestamp += datetime.timedelta(seconds=1)
self.timestamp.datetime += datetime.timedelta(seconds=1)
self.set_y(float(next_element(field)))
self.set_x(float(next_element(field)))
self.set_altitude(int(next_element(field)))
Expand Down
76 changes: 0 additions & 76 deletions blitzortung/builder/strike_cluster.py

This file was deleted.

Loading

0 comments on commit 0577158

Please sign in to comment.