File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
MiniRF.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "MiniRF.h"
10 
11 #include <QString>
12 
13 #include "IString.h"
14 #include "iTime.h"
15 #include "IException.h"
16 #include "RadarPulseMap.h"
17 #include "RadarGroundRangeMap.h"
18 #include "RadarSlantRangeMap.h"
19 #include "RadarGroundMap.h"
20 #include "RadarSkyMap.h"
21 
22 using namespace std;
23 
24 namespace Isis {
39  MiniRF::MiniRF(Isis::Cube &cube) : Isis::RadarCamera(cube) {
40 
41  // LRO MiniRF naif instrument code = -85700
42  if (naifIkCode() == -85700) {
43  m_instrumentNameLong = "Miniature Radio Frequency";
44  m_instrumentNameShort = "Mini-RF";
45  m_spacecraftNameLong = "Lunar Reconnaissance Orbiter";
46  m_spacecraftNameShort = "LRO";
47  }
48  // Chandrayaan Mini-SAR instrument code = -86001
49  else if (naifIkCode() == -86001) {
50  m_instrumentNameLong = "Miniature Synthetic Aperture Radar";
51  m_instrumentNameShort = "Mini-SAR";
52  m_spacecraftNameLong = "Chandrayaan 1";
53  m_spacecraftNameShort = "Chan1";
54  }
55  else {
56  QString msg = "Cube does not appear to be a mini RF image";
57  throw IException(IException::Programmer, msg, _FILEINFO_);
58  }
59 
60  // Get the ground range resolution (ScaledPixelHeight and ScaledPixelWidth
61  // are expected to be equal - mrf2isis checks for this)
62  Pvl &lab = *cube.label();
63  Isis::PvlGroup &inst = lab.findGroup("Instrument", Isis::Pvl::Traverse);
64  double groundRangeResolution = inst["ScaledPixelHeight"]; // meters
65 
66  // Synthesize the pixel pitch to the ground range resolution
67  SetPixelPitch(groundRangeResolution); // meters/pix
68 
69  // Focal length should always be slant range to the current ground
70  // point. This will be set each time the slant range is calculated.
71  // For now, set the focal length to 1.0.
72  SetFocalLength(1.0);
73 
74  // Get the start time from labels (the SpacecraftClockStartCount is set to
75  // is set to UNK in the PDS labels, so StartTime is used instead)
76  SpiceDouble etStart = iTime((QString)inst["StartTime"]).Et();
77 
78  // The line rate is in units of seconds in the PDS label. The exposure
79  // is the sum of the burst and the delay for the return. The movement of the
80  // spacecraft is negligible compared to the speed of light, so we are assuming
81  // the spacecraft hasn't moved between the burst and the return.
82  double lineRate = (double) inst["LineExposureDuration"];
83 
84  // Get the incidence angle at the center of the image
85  double incidenceAngle = (double) inst["IncidenceAngle"];
86  incidenceAngle = incidenceAngle * Isis::PI / 180.0;
87 
88  // Get the azimuth resolution at the center of the image
89  double azimuthResolution = (double) inst["AzimuthResolution"]; // label units are meters
90  azimuthResolution = azimuthResolution / 1000.0; // change to km
91 
92  // Get the range resolution at the center of the image
93  double rangeResolution = (double) inst["RangeResolution"]; // label units are meters
94 
95  // Get the wavelength or frequency of the instrument. This does not
96  // exist in the PDS labels, so it will need to be hardcoded until the
97  // PDS labels are updated. Right now, the mrf2isis program is putting
98  // a frequency value in the labels based on the instrument mode id.
99  double frequency = (double) inst["Frequency"]; // units are htz
100  double waveLength = clight_c() / frequency; // units are km/sec/htz
101 
102  // Setup map from image(sample,line) to radar(sample,time)
103  new RadarPulseMap(this, etStart, lineRate);
104 
105  // Setup map from radar(sample,time) to radar(groundrange,time)
106  Radar::LookDirection ldir = Radar::Right;
107  if((QString)inst["LookDirection"] == "LEFT") {
108  ldir = Radar::Left;
109  }
110  RadarGroundRangeMap::setTransform(naifIkCode(), groundRangeResolution,
111  this->Samples(), ldir);
112  new RadarGroundRangeMap(this, naifIkCode());
113 
114  // Calculate weighting for focal plane coordinates. This is done
115  // because the focal plane coordinates (slant range and Doppler
116  // shift) do not have the same units of measurement and cannot
117  // be used by jigsaw as is. The weighting factors convert the
118  // focal plane coordinates into comparitive values. The weighting
119  // factor for the Doppler shift requires spacecraft pointing and
120  // velocity at the center of the image, so it is calculated
121  // after Spice gets loaded.
122  double range_sigma = rangeResolution * sin(incidenceAngle) * 100; // scaled meters
123  double etMid = etStart + 0.5 * (this->ParentLines() + 1) * lineRate;
124 
125  // Setup the map from Radar(groundRange,t) to Radar(slantRange,t)
126  RadarSlantRangeMap *slantRangeMap = new RadarSlantRangeMap(this,
127  groundRangeResolution);
128  slantRangeMap->SetCoefficients(inst["RangeCoefficientSet"]);
129 
130  // Setup the ground and sky map
131  RadarGroundMap *groundMap = new RadarGroundMap(this, ldir, waveLength);
132  groundMap->SetRangeSigma(range_sigma);
133  new RadarSkyMap(this);
134 
135  // Set the time range to cover the cube
136  // Must be done last as the naif kernels will be unloaded
137  double etEnd = etStart + this->ParentLines() * lineRate + lineRate;
138  etStart = etStart - lineRate;
139  double tol = PixelResolution() / 100.;
140 
141  if(tol < 0.) {
142  // Alternative calculation of .01*ground resolution of a pixel
143  setTime(etMid);
144  tol = PixelPitch() * SpacecraftAltitude() / FocalLength() / 100.;
145  }
146  Spice::createCache(etStart, etEnd, this->ParentLines() + 1, tol);
147  setTime(etMid);
148  SpiceRotation *bodyFrame = this->bodyRotation();
149  SpicePosition *spaceCraft = this->instrumentPosition();
150 
151  SpiceDouble Ssc[6];
152  // Load the state into Ssc
153  vequ_c((SpiceDouble *) & (spaceCraft->Coordinate()[0]), Ssc);
154  vequ_c((SpiceDouble *) & (spaceCraft->Velocity()[0]), Ssc + 3);
155  // Create the J2000 to body-fixed state transformation matrix BJ
156  SpiceDouble BJ[6][6];
157  rav2xf_c(&(bodyFrame->Matrix()[0]), (SpiceDouble *) & (bodyFrame->AngularVelocity()[0]), BJ);
158  // Rotate the spacecraft state from J2000 to body-fixed
159  mxvg_c(BJ, Ssc, 6, 6, Ssc);
160  // Extract the body-fixed position and velocity
161  double Vsc[3];
162  double Xsc[3];
163  vequ_c(Ssc, Xsc);
164  vequ_c(Ssc + 3, Vsc);
165 
167  this->radii(radii);
168  double R = radii[0].kilometers();
169  double height = sqrt(Xsc[0] * Xsc[0] + Xsc[1] * Xsc[1] + Xsc[2] * Xsc[2]) - R;
170  double speed = vnorm_c(Vsc);
171  double dopplerSigma = 2.0 * speed * azimuthResolution / (waveLength *
172  height / cos(incidenceAngle)) * 100.;
173  groundMap->SetDopplerSigma(dopplerSigma);
174  slantRangeMap->SetWeightFactors(range_sigma, dopplerSigma);
175  }
176 
183  int MiniRF::CkFrameId() const {
184  std::string msg = "Cannot generate CK for MiniRF";
185  throw IException(IException::User, msg, _FILEINFO_);
186  }
187 
194  int MiniRF::CkReferenceId() const {
195  std::string msg = "Cannot generate CK for MiniRF";
196  throw IException(IException::User, msg, _FILEINFO_);
197  }
198 }
199 
210 extern "C" Isis::Camera *MiniRFPlugin(Isis::Cube &cube) {
211  return new Isis::MiniRF(cube);
212 }
Isis::Spice::radii
void radii(Distance r[3]) const
Returns the radii of the body in km.
Definition: Spice.cpp:930
Isis::SpicePosition
Obtain SPICE position information for a body.
Definition: SpicePosition.h:173
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::Spice::instrumentPosition
virtual SpicePosition * instrumentPosition() const
Accessor method for the instrument position.
Definition: Spice.cpp:1600
Isis::PI
const double PI
The mathematical constant PI.
Definition: Constants.h:40
Isis::Sensor::SpacecraftAltitude
double SpacecraftAltitude()
Returns the distance from the spacecraft to the subspacecraft point in km.
Definition: Sensor.cpp:701
Isis::Camera::ParentLines
int ParentLines() const
Returns the number of lines in the parent alphacube.
Definition: Camera.cpp:2806
Isis::RadarSlantRangeMap::SetWeightFactors
void SetWeightFactors(double range_sigma, double doppler_sigma)
Set the weight factors for slant range and Doppler shift.
Definition: RadarSlantRangeMap.cpp:309
Isis::MiniRF
LRO Mini-RF SAR and Chandrayaan 1 Mini-RF SAR.
Definition: MiniRF.h:56
Isis::Spice::naifIkCode
SpiceInt naifIkCode() const
This returns the NAIF IK code to use when reading from instrument kernels.
Definition: Spice.cpp:968
Isis::RadarCamera
Generic class for Radar Cameras.
Definition: RadarCamera.h:31
Isis::iTime
Parse and return pieces of a time string.
Definition: iTime.h:65
Isis::RadarGroundMap::SetDopplerSigma
void SetDopplerSigma(double dopplerSigma)
Set the doppler sigma.
Definition: RadarGroundMap.h:123
Isis::Camera::RadarGroundMap
friend class RadarGroundMap
A friend class to calculate focal length.
Definition: Camera.h:491
Isis::RadarSlantRangeMap::SetCoefficients
void SetCoefficients(PvlKeyword &keyword)
Load the ground range/slant range coefficients from the RangeCoefficientSet keyword.
Definition: RadarSlantRangeMap.cpp:256
Isis::Camera::RadarSlantRangeMap
friend class RadarSlantRangeMap
A friend class to calculate focal length.
Definition: Camera.h:492
Isis::Camera::m_instrumentNameLong
QString m_instrumentNameLong
Full instrument name.
Definition: Camera.h:496
Isis::RadarGroundRangeMap
Construct a mapping between image sample and Radar ground range.
Definition: RadarGroundRangeMap.h:38
Isis::SpicePosition::Coordinate
const std::vector< double > & Coordinate()
Return the current J2000 position.
Definition: SpicePosition.h:211
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::RadarSlantRangeMap
Convert between radar ground range and slant range.
Definition: RadarSlantRangeMap.h:53
Isis::Spice::createCache
virtual void createCache(iTime startTime, iTime endTime, const int size, double tol)
This method creates an internal cache of spacecraft and sun positions over a specified time range.
Definition: Spice.cpp:649
Isis::Camera
Definition: Camera.h:236
Isis::Distance
Distance measurement, usually in meters.
Definition: Distance.h:34
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::RadarGroundMap::SetRangeSigma
void SetRangeSigma(double rangeSigma)
Set the range sigma.
Definition: RadarGroundMap.h:113
Isis::Sensor::setTime
void setTime(const iTime &time)
By setting the time you essential set the position of the spacecraft and body as indicated in the cla...
Definition: Sensor.cpp:97
Isis::iTime::Et
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
Definition: iTime.h:126
Isis::Camera::SetPixelPitch
void SetPixelPitch()
Reads the Pixel Pitch from the instrument kernel.
Definition: Camera.cpp:1418
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::MiniRF::CkReferenceId
virtual int CkReferenceId() const
CK Reference ID.
Definition: MiniRF.cpp:194
Isis::SpiceRotation::AngularVelocity
std::vector< double > AngularVelocity()
Accessor method to get the angular velocity.
Definition: SpiceRotation.cpp:1365
Isis::Spice::bodyRotation
virtual SpiceRotation * bodyRotation() const
Accessor method for the body rotation.
Definition: Spice.cpp:1611
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Camera::m_spacecraftNameLong
QString m_spacecraftNameLong
Full spacecraft name.
Definition: Camera.h:498
Isis::Camera::Samples
int Samples() const
Returns the number of samples in the image.
Definition: Camera.cpp:2776
Isis::RadarPulseMap
Convert between alpha image coordinates and radar sample, time coordinates.
Definition: RadarPulseMap.h:35
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::Camera::FocalLength
double FocalLength() const
Returns the focal length.
Definition: Camera.cpp:2732
std
Namespace for the standard library.
Isis::RadarGroundMap
Convert between undistorted focal plane coordinate (slant range) and ground coordinates.
Definition: RadarGroundMap.h:94
Isis::Camera::m_instrumentNameShort
QString m_instrumentNameShort
Shortened instrument name.
Definition: Camera.h:497
Isis::Camera::PixelPitch
double PixelPitch() const
Returns the pixel pitch.
Definition: Camera.cpp:2742
Isis::Camera::PixelResolution
virtual double PixelResolution()
Returns the pixel resolution at the current position in meters/pixel.
Definition: Camera.cpp:670
Isis::Cube::label
Pvl * label() const
Returns a pointer to the IsisLabel object associated with the cube.
Definition: Cube.cpp:1701
Isis::SpiceRotation::Matrix
std::vector< double > Matrix()
Return the full rotation TJ as a matrix.
Definition: SpiceRotation.cpp:2865
Isis::SpicePosition::Velocity
const std::vector< double > & Velocity()
Return the current J2000 velocity.
Definition: SpicePosition.cpp:1269
Isis::MiniRF::CkFrameId
virtual int CkFrameId() const
CK frame ID.
Definition: MiniRF.cpp:183
Isis::RadarSkyMap
Convert between slantrange/groundrange and ra/dec coordinates.
Definition: RadarSkyMap.h:31
Isis::Camera::m_spacecraftNameShort
QString m_spacecraftNameShort
Shortened spacecraft name.
Definition: Camera.h:499
Isis::Camera::SetFocalLength
void SetFocalLength()
Reads the focal length from the instrument kernel.
Definition: Camera.cpp:1411
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::IException::User
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition: IException.h:126
Isis::SpiceRotation
Obtain SPICE rotation information for a body.
Definition: SpiceRotation.h:209

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:16:51