auromat.mapping.spacecraft module

class auromat.mapping.spacecraft.BaseSpacecraftMapping(wcsHeader, alti, cameraPosGCRS, photoTime, identifier, metadata=None, originalPhotoTime=None, fastCenterCalculation=False)[source]

Bases: auromat.mapping.astrometry.BaseAstrometryMapping

A mapping which is based on having a camera in/on a spacecraft looking both on earth and the stars and where no exact camera pointing is known. The stars were then used to derive a WCS definition with which it is possible to calculate the direction vector of each pixel.

intersectsEarth

Returns a boolean array indicating whether a pixel center intersects with the earth.

isConsistent(starPxCoords=None)[source]

Checks if the photo timestamp and astrometric solution used for mapping is plausible by analysing the mapping result.

Note that in general there are virtually no false solves when using astrometry.net.

Parameters:starPxCoords – array of shape (n,2) containing x,y pixel coordinates of stars which have been used for obtaining an astrometry solution; for astrometry.net, the quad stars can be used for this purpose, see auromat.solving.readQuadMatch()
Return type:True if consistent, False if not
originalPhotoTime
class auromat.mapping.spacecraft.FileSpacecraftMappingUnsanitized(wcsHeader, alti, imagePath, cameraPosGCRS, photoTime, identifier, metadata=None, originalPhotoTime=None, fastCenterCalculation=False)[source]

Bases: auromat.mapping.astrometry.ImageMaskAstrometryMixin, auromat.mapping.mapping.FileImageMixin, auromat.mapping.spacecraft.BaseSpacecraftMapping

Warning

Consider using FileSpacecraftMapping instead of this class. Masking is not supported here.

The purpose of this class is to access certain properties in a very efficient way by skipping any sanitization. See auromat.test.draw_test.testParallelsMeridiansPlotOptimized for an example usage of this behaviour.

createMasked(centerMask)[source]

Return a copy of this mapping with the given mask applied to img, latsCenter, lonsCenter, and elevation. Implementing classes must override this method and handle the lats and lons attributes and possible others. See maskedByElevation() for an application of this method.

Parameters:centerMask – the mask is not copied and should not be used after anymore after calling this method
class auromat.mapping.spacecraft.SpacecraftMappingPathProvider(imagePaths, wcsPaths, metadataPath=None, timeshift=None, noradId=None, tleFolder=None, spacetrack=None, altitude=110, maxTimeOffset=3, sequenceInParallel=False, fastCenterCalculation=False)[source]

Bases: auromat.mapping.mapping.BaseMappingProvider

Parameters:maxTimeOffset – in seconds
contains(date)[source]

Return True if there is a mapping for the given date within +-maxTimeOffset.

Parameters:date (datetime) –
Return type:bool
get(date)[source]

Returns the mapping which is closest to the given date within +-maxTimeOffset.

Parameters:date (datetime) –
Return type:BaseMapping or MappingCollection
Raises ValueError:
 when no mapping exists for the given date
getById(identifier)[source]

Returns the mapping with the given identifier.

Parameters:identifier (string) –
Return type:BaseMapping or MappingCollection
Raises ValueError:
 when no mapping with the given identifier exists
getSequence(dateBegin=None, dateEnd=None)[source]

Returns a generator of mappings ordered by date for the given date range. If dateBegin and dateEnd are None, then all available mappings are returned.

Parameters:
  • dateBegin (datetime) –
  • dateEnd (datetime) – inclusive
Return type:

list of BaseMapping or MappingCollection objects

imageFileExtension
range

The dates of the first and last available mappings.

Return type:datetime tuple (from, to)
class auromat.mapping.spacecraft.SpacecraftMappingProvider(imageSequenceFolder, wcsFolder=None, imageFileExtension=None, timeshift=None, noradId=None, tleFolder=None, spacetrack=None, altitude=110, maxTimeOffset=3, sequenceInParallel=False)[source]

Bases: auromat.mapping.mapping.BaseMappingProvider

Parameters:
  • imageSequenceFolder – folder path or a list of image file paths
  • wcsFolder – folder path or a list of wcs file paths; optional if imageSequenceFolder is a folder path and contains the wcs files
contains(date)[source]

Return True if there is a mapping for the given date within +-maxTimeOffset.

Parameters:date (datetime) –
Return type:bool
get(date)[source]

Returns the mapping which is closest to the given date within +-maxTimeOffset.

Parameters:date (datetime) –
Return type:BaseMapping or MappingCollection
Raises ValueError:
 when no mapping exists for the given date
getById(identifier)[source]

Returns the mapping with the given identifier.

Parameters:identifier (string) –
Return type:BaseMapping or MappingCollection
Raises ValueError:
 when no mapping with the given identifier exists
getSequence(dateBegin=None, dateEnd=None)[source]

Returns a generator of mappings ordered by date for the given date range. If dateBegin and dateEnd are None, then all available mappings are returned.

Parameters:
  • dateBegin (datetime) –
  • dateEnd (datetime) – inclusive
Return type:

list of BaseMapping or MappingCollection objects

imageFileExtension

e.g. ‘jpg’

range

The dates of the first and last available mappings.

Return type:datetime tuple (from, to)
reload()[source]

Refresh to current disk state if imageSequenceFolder and wcsFolder are folders instead of file path lists.

unsolvedIds
auromat.mapping.spacecraft.getMapping(imagePathOrArray, wcsPathOrHeader, timeshift=None, noradId=None, tleFolder=None, spacetrack=None, altitude=110, fastCenterCalculation=False, metadata=None, nosanitize=False, identifier=None)[source]

If timeshift is None, then the wcs header is first checked for a shifted timestamp and corresponding spacecraft position. In case no shifted timestamp exists, the wcs header is checked for the original timestamp and spacecraft position. If only the timestamp exists (which may be the case for externally produced wcs files), the spacecraft position is calculated from two-line elements. If the latter applies or ‘timeshift’ is given, then tleFolder must be given. If the tleFolder doesn’t contain a %noradid%.tle file, then spacetrack is used to download the data (or an error is raised if spacetrack is None). The NORAD ID is determined from the noradId parameter, or if that is None from the wcs header. If in the latter case the wcs header doesn’t contain the NORAD ID, then the ISS ID (25544) is used as a default and a warning is printed.

Parameters:
  • imagePathOrArray
  • wcsPathOrHeader
  • timeshift (datetime.timedelta) – if set, overrides the shifted timestamp stored in the wcs headers
  • noradId – if set, overrides the NORAD ID stored in the wcs headers
  • tleFolder – folder containing TLE files named noradid.tle
  • spacetrack – a Spacetrack class instance
  • altitude
Return type:

BaseSpacecraftMapping

auromat.mapping.spacecraft.getMappingSequence(imagePathsOrArrays, wcsPaths, metadatas=None, timeshift=None, noradId=None, tleFolder=None, spacetrack=None, altitude=110, parallel=False, fastCenterCalculation=False)[source]

Returns a generator of SpacecraftMapping objects for all images in ‘imageSequenceFolder’ which have a solution in ‘wcsFolder’. The order corresponds to the sorted filenames in ‘wcsFolder’.

Parameters:
  • imagePathsOrArrays (iterable) –
  • wcsPaths (list) –