From e1c2cd62b701cdaf7964ef8ab17792205ff991da Mon Sep 17 00:00:00 2001 From: Jason R Laura <jlaura@hemis.wr.usgs.gov> Date: Wed, 8 Jun 2016 11:16:28 -0700 Subject: [PATCH] Setup travis, coveralls, and README --- .coveragerc | 1 + README.rst | 23 +++++++++++++++++++ plio/io_controlnetwork.py | 1 + plio/tests/test_io_controlnetwork.py | 34 +++++++++++----------------- 4 files changed, 38 insertions(+), 21 deletions(-) create mode 100644 README.rst diff --git a/.coveragerc b/.coveragerc index 947c14c..b3aa334 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,6 +3,7 @@ source = autocnet [report] omit = plio/ControlNetFileV0002_pb2.py + */sqlalchemy_json/* */tests/* exclude_lines = pragma: no cover diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..ff6c7ca --- /dev/null +++ b/README.rst @@ -0,0 +1,23 @@ +=============================== +AutoCNet +=============================== + +.. image:: https://badges.gitter.im/USGS-Astrogeology/autocnet.svg + :alt: Join the chat at https://gitter.im/USGS-Astrogeology/autocnet + :target: https://gitter.im/USGS-Astrogeology/autocnet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge + +.. image:: https://img.shields.io/pypi/v/autocnet.svg + :target: https://pypi.python.org/pypi/plio + +.. image:: https://travis-ci.org/USGS-Astrogeology/plio.svg?branch=master + :target: https://travis-ci.org/USGS-Astrogeology/plio + +.. image:: https://coveralls.io/repos/USGS-Astrogeology/plio/badge.svg?branch=master&service=github + :target: https://coveralls.io/github/USGS-Astrogeology/plio?branch=master + +.. image:: https://readthedocs.org/projects/plio/badge/?version=latest + :target: http://plio.readthedocs.org/en/latest/ + :alt: Documentation Status + + +A planetary file I/O API diff --git a/plio/io_controlnetwork.py b/plio/io_controlnetwork.py index ca9cac1..a5972de 100644 --- a/plio/io_controlnetwork.py +++ b/plio/io_controlnetwork.py @@ -87,6 +87,7 @@ def to_isis(path, obj, mode='w', version=VERSION, point_sizes, creation_date, modified_date) + print(point_sizes) # Write the buffer header store.write(buffer_header, HEADERSTARTBYTE) # Then write the points, so we know where to start writing, + 1 to avoid overwrite diff --git a/plio/tests/test_io_controlnetwork.py b/plio/tests/test_io_controlnetwork.py index c038208..a087031 100644 --- a/plio/tests/test_io_controlnetwork.py +++ b/plio/tests/test_io_controlnetwork.py @@ -1,7 +1,7 @@ import os import sys +from time import strftime, gmtime import unittest -import numpy as np import pandas as pd import pvl @@ -22,29 +22,21 @@ class TestWriteIsisControlNetwork(unittest.TestCase): serial_times = {295: '1971-07-31T01:24:11.754', 296: '1971-07-31T01:24:36.970'} cls.serials = ['APOLLO15/METRIC/{}'.format(i) for i in serial_times.values()] - net = CandidateGraph({'a': ['b'], 'b': ['a']}) - for i, n in net.nodes_iter(data=True): - n._keypoints = pd.DataFrame(np.arange(10).reshape(cls.npts,-1), columns=['x', 'y']) - n._isis_serial = cls.serials[i] + columns = ['point_id', 'point_type', 'serialnumber', 'measure_type', 'x', 'y', 'node_id'] - source = np.zeros(cls.npts) - destination = np.ones(cls.npts) - pid = np.arange(cls.npts) + data = [] + for i in range(cls.npts): + data.append((i, 2, cls.serials[0], 2, 0, 0, 0)) + data.append((i, 2, cls.serials[1], 2, 0, 0, 1)) - matches = pd.DataFrame(np.vstack((source, pid, destination, pid)).T, columns=['source_image', - 'source_idx', - 'destination_image', - 'destination_idx']) + dfs = [pd.DataFrame(data, columns=columns)] - net.edge[0][1].matches = matches - net.generate_cnet(clean_keys=[]) + cls.creation_date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) + cls.modified_date = strftime("%Y-%m-%d %H:%M:%S", gmtime()) + io_controlnetwork.to_isis('test.net', dfs, mode='wb', targetname='Moon') - cls.creation_date = net.creationdate - cls.modified_date = net.modifieddate - io_controlnetwork.to_isis('test.net', net, mode='wb', targetname='Moon') - - cls.header_message_size = 98 - cls.point_start_byte = 65634 + cls.header_message_size = 78 + cls.point_start_byte = 65614 def test_create_buffer_header(self): with open('test.net', 'rb') as f: @@ -94,7 +86,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase): self.assertEqual(675, points_bytes) points_start_byte = find_in_dict(pvl_header, 'PointsStartByte') - self.assertEqual(65634, points_start_byte) + self.assertEqual(self.point_start_byte, points_start_byte) @classmethod def tearDownClass(cls): -- GitLab