SegmentationMap¶
- class snappl.segmap.SegmentationMap(id=None, provenance_id=None, format=None, l2image_id=None, filepath=None, base_path=None, base_dir=None, full_filepath=None, no_base_path=False)[source]¶
Bases:
PathedObjectEncapsulate a single segmentation map.
Properties of a SegmentationMap object are:
filepath : pathlib.Path ; path relative to the base path of the image file of the segmentation map
full_filepath : pathlib.Path ; absolute path to file on system. (Same as base_path / filepath.)
base_path : base path for images; usually will be Config value system.paths.segmaps
base_dir : synonym for base_path
- imagean Image object that holds the actual segmentation map data. Get the 2d numpy
data of segmap s in s.image.data
Set up object paths.
- Parameters:
filepath (str or Path, default None) – Path of the file relative to base_path. If no_base_path is True (which should never be the case for an object that is associated with the database), then this is the full path.
base_path (str or Path, default None) – Only use one of these; they set the same thing. (Both parameters are defined for backwards compatibility.) Most of the time you do not want to specify this, but leave it at the default. If no_base_path is True, you must leave these at None. This is the base path for objects of the subclass of PathedObject that is being constructed. By default (which is usually what you want), it will use a path that is configured for the type of object that the subclass tracks.
base_dir (str or Path, default None) – Only use one of these; they set the same thing. (Both parameters are defined for backwards compatibility.) Most of the time you do not want to specify this, but leave it at the default. If no_base_path is True, you must leave these at None. This is the base path for objects of the subclass of PathedObject that is being constructed. By default (which is usually what you want), it will use a path that is configured for the type of object that the subclass tracks.
full_filepath (str or Path, default None) – Usually you don’t want to specify this, but there are cases where you can.
no_base_path (bool, default False) – You may want to set this to True if you are dealing with files that aren’t tracked by the database. In that case, you can’t specify base_path (or base_dir), and filepath and full_filepath mean the same thing (and must be the same if for some reasdon you give both).
Attributes Summary
Methods Summary
find_segmaps([provenance, provenance_tag, ...])Find segmentation maps.
get_by_id(segmap_id[, dbclient])save_to_db([dbclient])Attributes Documentation
- image¶
- image_format_to_class = {1: <class 'snappl.image.OpenUniverse2024FITSImage'>, 2: <class 'snappl.image.FITSImageStdHeaders'>}¶
Methods Documentation
- classmethod find_segmaps(provenance=None, provenance_tag=None, process=None, dbclient=None, **kwargs)[source]¶
Find segmentation maps.
- Parameters:
provenance (Provenance, UUID, or str, default None) – The Provenacne, or the id of the Provenance, to search. Must specify either this, or both of provenance_tag and process.
provenance_tag (str, default None) – The provenance tag to search. Required if provenance is None.
process (str, default None) – The process of the provenance_tag to search. Required if provenance_tag is given.
ra (float, default None) – If ra and dec are given, will find all segmentation maps that include this point.
dec (float, default None) – If ra and dec are given, will find all segmentation maps that include this point.
ra_min (float, default None) –
If any of these are given, will limit images to things that fall within the relevant range. It probably doesn’t make sense to include any of these alongside (ra, dec).
NOTE: this refers the the centra ra of the segmentation map; it does not consider the corners. If you really want to be anal, you could include 16 parameters, ra_corner_00_min, ra_corner_00_max, etc. Be aware, however, that corner_00 refers to the lower-left of the image (i.e. pixel 0,0), which depending on rotation will not be an extremum of ra and dec.
WARNING : ra ranges crossing 0 are not yet properly implemented.
ra_max (float, default None) –
If any of these are given, will limit images to things that fall within the relevant range. It probably doesn’t make sense to include any of these alongside (ra, dec).
NOTE: this refers the the centra ra of the segmentation map; it does not consider the corners. If you really want to be anal, you could include 16 parameters, ra_corner_00_min, ra_corner_00_max, etc. Be aware, however, that corner_00 refers to the lower-left of the image (i.e. pixel 0,0), which depending on rotation will not be an extremum of ra and dec.
WARNING : ra ranges crossing 0 are not yet properly implemented.
dec_min (float, default None) –
If any of these are given, will limit images to things that fall within the relevant range. It probably doesn’t make sense to include any of these alongside (ra, dec).
NOTE: this refers the the centra ra of the segmentation map; it does not consider the corners. If you really want to be anal, you could include 16 parameters, ra_corner_00_min, ra_corner_00_max, etc. Be aware, however, that corner_00 refers to the lower-left of the image (i.e. pixel 0,0), which depending on rotation will not be an extremum of ra and dec.
WARNING : ra ranges crossing 0 are not yet properly implemented.
dec_max (float, default None) –
If any of these are given, will limit images to things that fall within the relevant range. It probably doesn’t make sense to include any of these alongside (ra, dec).
NOTE: this refers the the centra ra of the segmentation map; it does not consider the corners. If you really want to be anal, you could include 16 parameters, ra_corner_00_min, ra_corner_00_max, etc. Be aware, however, that corner_00 refers to the lower-left of the image (i.e. pixel 0,0), which depending on rotation will not be an extremum of ra and dec.
WARNING : ra ranges crossing 0 are not yet properly implemented.
band (str, default None) – If given, only include segmentation maps that go with this band.
l2image_id (str or UUID, default None) – If given, only find segmentation maps that go with this image.
- Return type: