Commit e35fc471 authored by Amy Stamile's avatar Amy Stamile
Browse files

removed full local paths

parent 92116f14
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:


# Sensor Utils
# Sensor Utils


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
import os
import os


os.environ["ISISROOT"] = "/Users/astamile/ISIS3/build"
os.environ["ISISDATA"] = "/Volumes/isis_data1/isis_data/"

from csmapi import csmapi
from csmapi import csmapi
from knoten import csm, sensor_utils
from knoten import csm, sensor_utils


from knoten.shape import Ellipsoid
from knoten.shape import Ellipsoid
from knoten.illuminator import Illuminator
from knoten.illuminator import Illuminator


import ale
import ale
import json
import json
```
```


%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:


## Create a usgscsm sensor model
## Create a usgscsm sensor model


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
fileName = "data/N1573082850_1.cub"
fileName = "data/N1573082850_1.cub"


kernels = ale.util.generate_kernels_from_cube(fileName, expand=True)
kernels = ale.util.generate_kernels_from_cube(fileName, expand=True)
isd_string = ale.loads(fileName, props={'kernels': kernels})
isd_string = ale.loads(fileName, props={'kernels': kernels})
csm_isd = os.path.splitext(fileName)[0] + '.json'
csm_isd = os.path.splitext(fileName)[0] + '.json'


with open(csm_isd, 'w') as isd_file:
with open(csm_isd, 'w') as isd_file:
    isd_file.write(isd_string)
    isd_file.write(isd_string)
```
```


%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:


## Run Sensor Utils with usgscsm sensor model and image point
## Run Sensor Utils with usgscsm sensor model and image point


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
camera = csm.create_csm(csm_isd)
camera = csm.create_csm(csm_isd)
image_pt = csmapi.ImageCoord(511.5, 511.5)
image_pt = csmapi.ImageCoord(511.5, 511.5)
shape = Ellipsoid.from_csm_sensor(camera)
shape = Ellipsoid.from_csm_sensor(camera)
illuminator = Illuminator()
illuminator = Illuminator()
```
```


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
phaseAngle = sensor_utils.phase_angle(image_pt, camera, shape, illuminator)
phaseAngle = sensor_utils.phase_angle(image_pt, camera, shape, illuminator)


phaseAngle
phaseAngle
```
```


%% Output
%% Output


    38.87212509629895
    38.87212509629895


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
emissionAngle = sensor_utils.emission_angle(image_pt, camera, shape)
emissionAngle = sensor_utils.emission_angle(image_pt, camera, shape)


emissionAngle
emissionAngle
```
```


%% Output
%% Output


    49.60309924893989
    49.60309924893989


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
slantDistance = sensor_utils.slant_distance(image_pt, camera, shape)
slantDistance = sensor_utils.slant_distance(image_pt, camera, shape)


slantDistance
slantDistance
```
```


%% Output
%% Output


    2903512972.146115
    2903512972.146115


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
targetCenterDistance = sensor_utils.target_center_distance(image_pt, camera)
targetCenterDistance = sensor_utils.target_center_distance(image_pt, camera)


targetCenterDistance
targetCenterDistance
```
```


%% Output
%% Output


    2943536048.858226
    2943536048.858226


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
subSpacecraftPoint = sensor_utils.sub_spacecraft_point(image_pt, camera)
subSpacecraftPoint = sensor_utils.sub_spacecraft_point(image_pt, camera)


subSpacecraftPoint
subSpacecraftPoint
```
```


%% Output
%% Output


    LatLon(lat=3.2229625890973583, lon=258.6197326526089)
    LatLon(lat=3.2229625890973583, lon=258.6197326526089)


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
localRadius = sensor_utils.local_radius(image_pt, camera, shape)
localRadius = sensor_utils.local_radius(image_pt, camera, shape)


localRadius
localRadius
```
```


%% Output
%% Output


    59096282.024265066
    59096282.024265066


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
rightAscDec = sensor_utils.right_ascension_declination(image_pt, camera)
rightAscDec = sensor_utils.right_ascension_declination(image_pt, camera)


rightAscDec
rightAscDec
```
```


%% Output
%% Output


    (79.34815579474038, -2.7790780986459485)
    (79.34815579474038, -2.7790780986459485)


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
lineResolution = sensor_utils.line_resolution(image_pt, camera, shape)
lineResolution = sensor_utils.line_resolution(image_pt, camera, shape)


lineResolution
lineResolution
```
```


%% Output
%% Output


    17397.96094194587
    17397.96094194587


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
sampleResolution = sensor_utils.sample_resolution(image_pt, camera, shape)
sampleResolution = sensor_utils.sample_resolution(image_pt, camera, shape)


sampleResolution
sampleResolution
```
```


%% Output
%% Output


    17397.93370038153
    17397.93370038153


%% Cell type:code id: tags:
%% Cell type:code id: tags:


``` python
``` python
pixelResolution = sensor_utils.pixel_resolution(image_pt, camera, shape)
pixelResolution = sensor_utils.pixel_resolution(image_pt, camera, shape)


pixelResolution
pixelResolution
```
```


%% Output
%% Output


    17397.9473211637
    17397.9473211637