Commit 9fd8f118 authored by Kristin Berry's avatar Kristin Berry
Browse files

Merge pull request #48 from jlaura/master

Homography Updates
parents 7c55c0aa 62b91eaa
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2,9 +2,9 @@
source = autocnet
[report]
omit =
    fileio/ControlNetFileV0002_pb2.py
    utils/visualization.py
    vis/*
    autocnet/fileio/ControlNetFileV0002_pb2.py
    autocnet/vis/graph_view.py
    autocnet/fileio/sqlalchemy_json/*
exclude_lines =
    pragma: no cover
    def __repr__
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ install:
  - conda info -a

  # Create a virtual env and install dependencies
  - conda create -y -q -n test-env python=$TRAVIS_PYTHON_VERSION nose numpy pillow scipy pandas networkx scikit-image
  - conda create -y -q -n test-env python=$TRAVIS_PYTHON_VERSION nose numpy pillow scipy pandas networkx scikit-image sqlalchemy
  # Activate the env
  - source activate test-env

+10 −0
Original line number Diff line number Diff line
import os
import autocnet

__version__ = "0.1.0"

def get_data(filename):
    packagdir = autocnet.__path__[0]
    dirname = os.path.join(os.path.dirname(packagdir), 'data')
    fullname = os.path.join(dirname, filename)
    return fullname
+415 −0
Original line number Diff line number Diff line
Object = IsisCube
  Object = Core
    StartByte   = 65537
    Format      = Tile
    TileSamples = 128
    TileLines   = 128

    Group = Dimensions
      Samples = 5725
      Lines   = 5725
      Bands   = 1
    End_Group

    Group = Pixels
      Type       = Real
      ByteOrder  = Lsb
      Base       = 0.0
      Multiplier = 1.0
    End_Group
  End_Object

  Group = Instrument
    SpacecraftName     = "APOLLO 15"
    InstrumentId       = METRIC
    TargetName         = MOON
    Original_StartTime = APOLLO15/METRIC/1971-07-31T14:02:28.186
    Original_StartTime = 1971-07-31T14:02:28.186
    StartTime          = 1971-07-31T14:02:27.179
  End_Group

  Group = BandBin
    FilterName = CLEAR
    FilterId   = 1
  End_Group

  Group = Kernels
    NaifFrameCode             = -915240
    LeapSecond                = $base/kernels/lsk/naif0010.tls
    TargetAttitudeShape       = ($base/kernels/pck/pck00009.tpc,
                                 $base/kernels/pck/lunar_de403_1950-2199_pa.bp-
                                 c, $base/kernels/fk/lunarMeanEarth001.tf)
    TargetPosition            = (Table, $base/kernels/spk/de405.bsp)
    InstrumentPointing        = (Table,
                                 $apollo15/kernels/ck/AS15_M_REV22_v2.bc,
                                 $apollo15/kernels/fk/apollo15_v2.0001.tf)
    Instrument                = $apollo15/kernels/ik/apollo15_metric_v2.0001.-
                                ti
    SpacecraftClock           = $apollo15/kernels/sclk/apollo15.0001.tsc
    InstrumentPosition        = (Table,
                                 $apollo15/kernels/spk/AS15_M_REV22_v2.bsp)
    InstrumentAddendum        = $apollo15/kernels/iak/apollo15MetricAddendum0-
                                02.ti
    ShapeModel                = $base/dems/ldem_128ppd_Mar2011_clon180_radius-
                                _pad.cub
    InstrumentPositionQuality = Reconstructed
    InstrumentPointingQuality = Reconstructed
    CameraVersion             = 2
  End_Group

  Group = AlphaCube
    AlphaSamples        = 22900
    AlphaLines          = 22900
    AlphaStartingSample = 0.5
    AlphaStartingLine   = 0.5
    AlphaEndingSample   = 22900.5
    AlphaEndingLine     = 22900.5
    BetaSamples         = 5725
    BetaLines           = 5725
  End_Group

  Group = Reseaus
    Sample   = (1422.62, 1422.62, 1422.62, 1422.62, 1422.62, 1422.62, 1422.62,
                1422.62, 1422.62, 1422.62, 1422.62, 3428.38, 3428.38, 3428.38,
                3428.38, 3428.38, 3428.38, 3428.38, 3428.38, 3428.38, 3428.38,
                3428.38, 5434.2, 5434.2, 5434.2, 5434.2, 5434.2, 5434.2,
                5434.2, 5434.2, 5434.2, 5434.2, 5434.2, 7439.68, 7439.68,
                7439.68, 7439.68, 7439.68, 7439.68, 7439.68, 7439.68, 7439.68,
                7439.68, 7439.68, 9444.78, 9444.78, 9444.78, 9444.78, 9444.78,
                9444.78, 9444.78, 9444.78, 9444.78, 9444.78, 9444.78, 11450.0,
                11450.0, 11450.0, 11450.0, 11450.0, 11450.0, 11450.0, 11450.0,
                11450.0, 11450.0, 11450.0, 13455.3, 13455.3, 13455.3, 13455.3,
                13455.3, 13455.3, 13455.3, 13455.3, 13455.3, 13455.3, 13455.3,
                15460.7, 15460.7, 15460.7, 15460.7, 15460.7, 15460.7, 15460.7,
                15460.7, 15460.7, 15460.7, 15460.7, 17466.1, 17466.1, 17466.1,
                17466.1, 17466.1, 17466.1, 17466.1, 17466.1, 17466.1, 17466.1,
                17466.1, 19472.1, 19472.1, 19472.1, 19472.1, 19472.1, 19472.1,
                19472.1, 19472.1, 19472.1, 19472.1, 19472.1, 21477.7, 21477.7,
                21477.7, 21477.7, 21477.7, 21477.7, 21477.7, 21477.7, 21477.7,
                21477.7, 21477.7)
    Line     = (21476.5, 19466.3, 17466.0, 15460.7, 13455.4, 11450.0, 9444.32,
                7438.86, 5433.14, 3427.88, 1422.52, 21476.5, 19466.3, 17466.0,
                15460.7, 13455.4, 11450.0, 9444.32, 7438.86, 5433.14, 3427.88,
                1422.52, 21476.5, 19466.3, 17466.0, 15460.7, 13455.4, 11450.0,
                9444.32, 7438.86, 5433.14, 3427.88, 1422.52, 21476.5, 19466.3,
                17466.0, 15460.7, 13455.4, 11450.0, 9444.32, 7438.86, 5433.14,
                3427.88, 1422.52, 21476.5, 19466.3, 17466.0, 15460.7, 13455.4,
                11450.0, 9444.32, 7438.86, 5433.14, 3427.88, 1422.52, 21476.5,
                19466.3, 17466.0, 15460.7, 13455.4, 11450.0, 9444.32, 7438.86,
                5433.14, 3427.88, 1422.52, 21476.5, 19466.3, 17466.0, 15460.7,
                13455.4, 11450.0, 9444.32, 7438.86, 5433.14, 3427.88, 1422.52,
                21476.5, 19466.3, 17466.0, 15460.7, 13455.4, 11450.0, 9444.32,
                7438.86, 5433.14, 3427.88, 1422.52, 21476.5, 19466.3, 17466.0,
                15460.7, 13455.4, 11450.0, 9444.32, 7438.86, 5433.14, 3427.88,
                1422.52, 21476.5, 19466.3, 17466.0, 15460.7, 13455.4, 11450.0,
                9444.32, 7438.86, 5433.14, 3427.88, 1422.52, 21476.5, 19466.3,
                17466.0, 15460.7, 13455.4, 11450.0, 9444.32, 7438.86, 5433.14,
                3427.88, 1422.52)
    Type     = (5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
                5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5)
    Valid    = (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
                1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1,
                0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1)
    Template = $apollo15/reseaus/METRIC_TEMPLATE.cub
    Master   = $apollo15/reseaus/METRIC_MASTER.pvl
    Status   = Removed
  End_Group

  Group = Code
    StartTime                 = 1971-07-31T14:02:28.186
    SpacecraftAltitude        = 104459 <meters>
    ExposureDuration          = 22.2 <milliseconds>
    ForwardMotionCompensation = False
    Column1                   = (1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0,
                                 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0,
                                 0, 1)
    Column2                   = (1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0,
                                 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1,
                                 0, 1)
    Column3                   = (1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
                                 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0,
                                 0, 1)
    Column4                   = (1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0,
                                 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 1)
  End_Group
End_Object

Object = Label
  Bytes = 65536
End_Object

Object = Table
  Name                = InstrumentPointing
  StartByte           = 132960883
  Bytes               = 64
  Records             = 1
  ByteOrder           = Lsb
  TimeDependentFrames = (-915240, 1400015, 1)
  CkTableStartTime    = -896911011.63772
  CkTableEndTime      = -896911011.63772
  CkTableOriginalSize = 1
  Description         = "Created by spiceinit"
  Kernels             = ($apollo15/kernels/ck/AS15_M_REV22_v2.bc,
                         $apollo15/kernels/fk/apollo15_v2.0001.tf)

  Group = Field
    Name = J2000Q0
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q1
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q2
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q3
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV1
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV2
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV3
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = ET
    Type = Double
    Size = 1
  End_Group
End_Object

Object = Table
  Name                 = InstrumentPosition
  StartByte            = 132776001
  Bytes                = 56
  Records              = 1
  ByteOrder            = Lsb
  CacheType            = Linear
  SpkTableStartTime    = -896911011.63772
  SpkTableEndTime      = -896911011.63772
  SpkTableOriginalSize = 1.0
  Description          = "Created by spiceinit"
  Kernels              = $apollo15/kernels/spk/AS15_M_REV22_v2.bsp

  Group = Field
    Name = J2000X
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Y
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Z
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000XV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000YV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000ZV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = ET
    Type = Double
    Size = 1
  End_Group
End_Object

Object = Table
  Name                = BodyRotation
  StartByte           = 132776057
  Bytes               = 64
  Records             = 1
  ByteOrder           = Lsb
  TimeDependentFrames = (310002, 1)
  ConstantFrames      = (310001, 310003, 310000, 310002)
  ConstantRotation    = (0.99999987852709, -3.09789127116553e-04,
                         3.83375135592436e-04, 3.09789421617701e-04,
                         0.999999952015, -7.08797549693787e-07,
                         -3.83374897618408e-04, 8.27563025111877e-07,
                         0.9999999265115)
  CkTableStartTime    = -896911011.63772
  CkTableEndTime      = -896911011.63772
  CkTableOriginalSize = 1
  Description         = "Created by spiceinit"
  Kernels             = ($base/kernels/spk/de405.bsp,
                         $base/kernels/pck/pck00009.tpc,
                         $base/kernels/pck/lunar_de403_1950-2199_pa.bpc,
                         $base/kernels/fk/lunarMeanEarth001.tf)
  SolarLongitude      = 171.71980671154

  Group = Field
    Name = J2000Q0
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q1
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q2
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Q3
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV1
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV2
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = AV3
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = ET
    Type = Double
    Size = 1
  End_Group
End_Object

Object = Table
  Name                 = SunPosition
  StartByte            = 132776121
  Bytes                = 56
  Records              = 1
  ByteOrder            = Lsb
  CacheType            = Linear
  SpkTableStartTime    = -896911011.63772
  SpkTableEndTime      = -896911011.63772
  SpkTableOriginalSize = 1.0
  Description          = "Created by spiceinit"
  Kernels              = $base/kernels/spk/de405.bsp

  Group = Field
    Name = J2000X
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Y
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000Z
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000XV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000YV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = J2000ZV
    Type = Double
    Size = 1
  End_Group

  Group = Field
    Name = ET
    Type = Double
    Size = 1
  End_Group
End_Object

Object = History
  Name      = IsisCube
  StartByte = 132960979
  Bytes     = 117898
End_Object

Object = NaifKeywords
  BODY301_RADII           = (1737.4, 1737.4, 1737.4)
  BODY_FRAME_CODE         = 310001
  INS-915240_FOCAL_LENGTH = 76.054
  INS-915240_PIXEL_PITCH  = 0.005
  INS-915240_TRANSX       = (0.0, -0.005, 0.0)
  INS-915240_TRANSY       = (0.0, 0.0, 0.005)
  INS-915240_ITRANSS      = (0.0, -200.0, 0.0)
  INS-915240_ITRANSL      = (0.0, 0.0, 200.0)
  INS-915240_PP           = (-0.006, -0.002)
  INS-915240_OD_K         = (-1.3361854e-06, 5.2261757e-10, -5.0728336e-14)
  INS-915240_DECENTER     = (-5.4958195e-07, -4.608942e-11, 2.965907)
End_Object
End
 No newline at end of file
+57 −0
Original line number Diff line number Diff line
from sqlalchemy import Column, Integer, String, create_engine, orm
from sqlalchemy.ext import declarative

from autocnet.fileio.sqlalchemy_json.alchemy import NestedJsonObject

Base = declarative.declarative_base()


def setup_db_session(db):
    """
    Add a database session object to the root namespace

    Parameters
    ----------
    db : str
         Database name

    Returns
    -------
     : object
       A SQLAlchemy session object
    """
    engine = create_engine('sqlite:///{}'.format(db))
    Base.metadata.bind = engine
    Base.metadata.create_all()
    return orm.sessionmaker(bind=engine)()


class Translations(Base):  # pragma: no cover
    """
    Table mapping for the ISIS Translation file table
    """
    __tablename__ = 'isis_translations'
    id = Column(Integer, primary_key=True)
    mission = Column(String)
    instrument = Column(String)
    translation = Column(NestedJsonObject)

    def __init__(self, mission, instrument, translation):
        self.mission = mission
        self.instrument = instrument
        self.translation = translation


class StringToMission(Base):  # pragma: no cover
    """
    Table mapping for the ISIS mission name cleaner table
    """
    __tablename__ = 'isis_mission_to_standard'
    id = Column(Integer, primary_key=True)
    key = Column(String)
    value = Column(String)

    def __init__(self, key, value):
        self.key = key
        self.value = value
Loading