sarkit.verification.CphdConsistency
- class CphdConsistency(cphd_xml, *, file_type_header=None, kvp_list=None, pvps=None, schema_override=None, file=None)
Check CPHD file structure and metadata for internal consistency
CphdConsistencyobjects should be instantiated usingfrom_fileorfrom_parts.- Parameters:
- cphd_xml
lxml.etree.Elementorlxml.etree.ElementTree CPHD XML
- file_type_header
str, optional File type header from the first line of the file
- kvp_list
dictof {strstr}, optional Key-Value pair list of header fields
- pvps
dictof {strndarray}, optional CPHD Per-Vector-Parameters keyed by channel identifier
- schema_override
path-like object, optional Path to XML Schema. If None, tries to find a version-specific schema
- file
file object, optional CPHD file; when specified, portions of the file not specified in other parameters may be read
- cphd_xml
Methods
add_cli_args(parser)Add CLI args used by
run_clito an argparserall()Returns all results.
check([func_name, allow_prefix, ignore_patterns])Run checks.
failures([omit_passed_sub])Returns failure results.
from_file(file[, schema, thorough])Create a CphdConsistency object from a file
from_parts(cphd_xml[, file_type_header, ...])Create a CphdConsistency object from assorted parts
get_polygon(polygon_node[, check])Returns the polygon from the specified node, with basic polygon verification.
need([details])Context manager for scoping 'Error' level checks
passes()Returns passed checks that are not wholly No-Op.
precondition([details])Context manager for scoping conditional ('No-Op' level) checks
print_result(*[, include_passed_asserts, ...])Print results to stdout.
run_cli(config)Run checks and print results using args from
add_cli_argsskips([include_partial])Returns passed checks that are No-Op.
want([details])Context manager for scoping 'Warning' level checks
Notes
The following checks are available:
check_against_schemaThe XML matches the schema.
check_antennaCheck that antenna node is consistent.
check_antenna_array_element_antgpidCheck that Array/AntGPId and Element/AntGPId, when present, are included together in /Antenna/AntPattern.
check_antenna_array_element_antgpid_existCheck that used GPIds exist
check_antenna_arrayid_elementid_existCheck that used gain phase arrays exist
check_antenna_ebfreqshiftsfAntPattern/EBFreqShiftSF only included for EBFreqShift = true
check_antenna_ids_in_channelIf the Antenna branch exists, then Antenna is also present in /Channel/Parameters
check_antenna_mlfreqdilationsfAntPattern/MLFreqDilationSF only included for MLFreqDilation = true
check_antenna_useacfpvpUseACFPVP only included when PVP TxAntenna & RcvAntenna are included.
check_antenna_useebpvpUseEBPVP only included when PVP TxAntenna & RcvAntenna are included.
check_antgainphase_support_array_domainSupportArray/AntGainPhase grid coordinates are valid direction cosines.
check_channel_afdopaFDOP PVP is consistent with other PVPs.
check_channel_afrr1aFRR1 is consistent with /TxRcv/TxWFParameters/LFMRate.
check_channel_afrr1_afrr2_relativeaFRR1 & aFRR2 PVPs are related by fx_C.
check_channel_afrr2aFRR2 is consistent with /TxRcv/TxWFParameters/LFMRate(s).
check_channel_antenna_existThe antenna patterns and phase centers exist if declared.
check_channel_dtaidIf a DTAId is specified, the support array exists
check_channel_dwell_polys/Dwell/CODTime/CODTimePoly and /Dwell/DwellTime/DwellTimePoly are consistent with other metadata.
check_channel_dwell_usedtaUseDTA only present with DTAId
check_channel_fx2_gt_fx1FX2 PVPs greater than FX1 PVPs.
check_channel_fx_osrFX domain vectors are sufficiently sampled
check_channel_fxbwPVP agrees with FxBW.
check_channel_fxbwnoisePVP agrees with FxBWNoise.
check_channel_fxcPVP agrees with FxC.
check_channel_fxfixedPVP agrees with FXFixed.
check_channel_global_fxminmaxPVP within global FxMin and FxMax.
check_channel_global_toaswathPVP within global TOASwath.
check_channel_global_txtimePVP within global TxTime1 and TxTime2.
check_channel_identifier_uniquenessIdentifier nodes within /Channel/Parameters are unique.
check_channel_imagearea_polygonImage area polygon is simple and consistent with X1Y1 and X2Y2.
check_channel_imagearea_x1y1Channel/Parameters/ImageArea X1Y1 and X2Y2 consistent with SceneCoordinates/ImageArea X1Y1 and X2Y2.
check_channel_normal_signal_pvpSIGNAL PVP = 1 for at least half of the vectors.
check_channel_positive_pvpsFX1, FX2, SC0, SCSS PVPs are strictly positive
check_channel_rcv_sample_rate/TxRcv/RcvParameters/SampleRate sufficient to support saved TOA swath.
check_channel_rcvpolrefReceive polarization parameters are consistent with Antenna metadata.
check_channel_signal_dataCheck contents of signal array.
check_channel_signalnormalPVP agrees with SignalNormal.
check_channel_srpfixedPVP agrees with SRPFixed.
check_channel_toa_osrTOA domain vectors are sufficiently sampled
check_channel_toaextsavedPVP agrees with TOAExtSaved.
check_channel_toafixedPVP agrees with TOAFixed.
check_channel_toasavedPVP agrees with TOASaved.
check_channel_txpolrefTransmit polarization parameters are consistent with Antenna metadata.
check_channel_txrcv_existThe declared TxRcv nodes exist.
check_classification_and_release_infoAsserts that the Classification and ReleaseInfo fields are the same in header KVP list and the xml.
check_data_num_bytes_pvp_accommodates_pvps/Data/NumBytesPVP is large enough to accommodate PVPs described in XML
check_data_num_bytes_pvp_is_valid/Data/NumBytesPVP is a multiple of 8 and > 0
check_data_num_cphd_channels/Data/NumCPHDChannels matches #{/Data/Channel} nodes
check_data_num_support_arrays/Data/NumSupportArrays matches #{/Data/SupportArray} nodes
check_dwell_num_cod_times/Dwell/NumCODTimes matches #{/Dwell/CODTime} nodes
check_dwell_num_dwell_times/Dwell/NumDwellTimes matches #{/Dwell/DwellTime} nodes
check_extended_imagearea_polygonScene extended area polygon is simple and consistent with X1Y1 and X2Y2.
check_extended_imagearea_x1y1_x2y2Extended image area contains the image area.
check_file_fxfixedThe FXFixedCPHD element matches the rest of the file.
check_file_srpfixedThe SRPFixedCPHD element matches the rest of the file.
check_file_toafixedThe TOAFixedCPHD element matches the rest of the file.
check_file_type_headerFile type header is consistent with the XML.
check_first_pvp_zero_offsetFirst PVP in the layout has zero offset
check_first_txtimeFirst TxTime greater than 0.
check_gaps_between_pvpsPVP layout described in XML does not contain gaps between parameters.
check_geoinfo_polygonsGeoInfo polygons are simple polygons in clockwise order.
check_global_fx_bandThe Global FXBand matches the PVPs.
check_global_toaswathThe Global TOASwath matches the PVPs.
check_global_txtime_limitsThe Global TxTime1 and TxTime2 match the PVPs.
check_header_kvp_listAsserts that the required keys are in the header KVP list.
check_identifier_uniquenessIdentifier nodes are unique.
check_image_area_corner_pointsThe corner points represent a simple quadrilateral in clockwise order.
check_image_gridSceneCoordinates/ImageGrid is consistent with ImageArea
check_image_grid_existsVerify that the ImageGrid is defined
check_imagearea_polygonScene Image area polygon is simple and consistent with X1Y1 and X2Y2.
check_imagearea_x1y1_x2y2SceneCoordinates/ImageArea is self-consistent.
check_optional_pvps_fxFXN1 & FXN2 PVPs are included appropriately.
check_optional_pvps_toaTOAE1 & TOAE2 PVPs are included appropriately.
check_overlapping_pvpsPVP layout described in XML does not contain overlapping parameters.
check_pad_after_pvpThe pad after PVPs is 0.
check_pad_after_supportThe pad after support arrays is 0.
check_pad_after_xmlThe pad after XML is 0.
check_pad_header_xmlThe pad between the header and XML is 0.
check_polynomialsPolynomial types are correctly specified.
check_pvp_block_sizePVP_BLOCK_SIZE in header consistent with XML /Data branch.
check_pvp_set_finitenessPVP sets have the same per-vector finiteness.
check_rcv_acxyRcvACX and RcvACY PVPs are orthonormal
check_rcv_after_txRcvTime is after TxTime.
check_rcv_finiteRcvTime and Pos are finite.
check_rcvebRcvEB composed of valid direction cosines
check_refgeomThe ReferenceGeometry parameters are consistent with the other metadata
check_scene_plane_axis_vectorsScene plane axis vectors are orthonormal.
check_segment_polygonsSegmentPolygons are simple, valid and clockwise.
check_signal_at_end_of_fileSignal is at the end of the file.
check_signal_block_size_and_packingSignal block is correctly sized and packed
check_support_arrays_have_dataEach /SupportArray array has a corresponding /Data/SupportArray
check_time_increasingPVP times increase.
check_tx_acxyTxACX and TxACY PVPs are orthonormal
check_txebTxEB composed of valid direction cosines
check_txrcv_ids_in_channelIf the TxRcv branch exists, then TxRcv is also present in /Channel/Parameters
check_txrcv_lfmrateTxRcv LFMRate is not zero.
check_txrcv_posvel_residualsTx/Rcv Position/Velocity PVPs have small polyfit residual.