Wise project module

Summary

wise.project.AnalysisContext([config])

An analysis context encapsulates all the configuration and the results of a project.

Methods

Full reference

class wise.project.DataConfiguration

Data configuration object.

class wise.project.AnalysisConfiguration

Analysis configuration container.

data

Data configuration

Type:

DataConfiguration

finder

Detection configuration

Type:

FinderConfiguration

matcher

Matcher configuration

Type:

MatcherConfiguration

class wise.project.AnalysisResult(config)

Analysis result container.

Parameters:

config (AnalysisConfiguration) – The project configuration used.

config

Configuration used during processing

Type:

AnalysisConfiguration

detection

Detection result

Type:

wise.wds.MultiScaleImageSet

image_set

Set of images

Type:

libwise.imgutils.ImageSet

Matching result (as FetauresLinks)

Type:

wise.matcher.MultiScaleFeaturesLinkBuilder

ms_match_results

Matching result (as FeaturesMatch and DeltaInformation)

Type:

wise.matcher.MultiScaleMatchResultSet

has_detection_result()

Return True if this object contains any detection result.

has_match_result()

Return True if this object contains any matching result.

get_scales()

Return the list of scales in the results

add_detection_result(img, res)

Add a detection result

add_match_result(match_res)

Add a matching result

get_match_result()

Get the matching result as a tuple of wise.matcher.MultiScaleMatchResultSet and wise.matcher.MultiScaleFeaturesLinkBuilder

get_detection_result()

Get the detection result as a wise.wds.MultiScaleImageSet

class wise.project.AnalysisContext(config=None)

An analysis context encapsulates all the configuration and the results of a project.

Example

>>> ctx = wise.AnalysisContext()
>>> ctx.config.data.data_dir = os.path.expanduser("~/project/data")
>>> ctx.config.finder.min_scale = 1
>>> ctx.config.finder.max_scale = 3
>>> ctx.config.matcher.method_klass = wise.ScaleMatcherMSCSC2
>>> ctx.select_files(os.path.expanduser("~/project/files/*"))
Parameters:

config (AnalysisConfiguration, optional) – The project configuration. If not set, a default configuration will be used.

config

The project configuration.

Type:

AnalysisConfiguration

files

The project files.

Type:

list

result

the project results.

Type:

AnalysisResult

get_data_dir()

Return the project data directory as configured by config.data.data_dir. If the directory does not exist, it will be created.

get_projection(img=None)

Return a libwise.imgutils.Projection corresponding to img and the settings defined in config.data. If img is not set, the reference image will be used instead.

Parameters:

img (libwise.imgutils.Image)

get_core_offset()

Return a CoreOffsetPositions based on the core position defined in the file self.config.data.core_offset_filename.

get_mask()

Return a mask (libwise.imgutils.Image) from self.config.data.mask_filename.

get_ref_image(preprocess=True)

Return the reference image (libwise.imgutils.Image) of the project, used for the projection defintion and several plotting tasks.

A reference image can be set using self.config.data.ref_image_filename. Alternatively the first file of the project is used.

Parameters:

preprocess (bool, optional) – If True, the reference image is pre processed .

set_ref_image(img)

Set the reference image.

Parameters:

img (libwise.imgutils.Image) – The new reference image.

get_result()

Return the project result (AnalysisResult)

get_match_result()

Return the matching result (tuple of wise.matcher.MultiScaleMatchResultSet and wise.matcher.MultiScaleFeaturesLinkBuilder).

get_detection_result()

Return the detection result (wise.wds.MultiScaleImageSet).

align(img)

Align image using core position defined in self.config.data.core_offset_filename.

Parameters:

img (libwise.imgutils.Image) – The image to align.

build_stack_image(preprocess=False, nsigma=0, nsigma_connected=False)
Create a stacked image (libwise.imgutils.StackedImage of all

the project images, aligning them if necessary.

Parameters:
  • preprocess (bool, optional) – If True, the images are pre processed .

  • nsigma (int, optional) – Clip bg below nsigma level

  • nsigma_connected (bool, optional) – If True, keep only the brightest connected structure

open_file(file)

Open file and return an image (libwise.imgutils.Image).

get_bg(img)

Return either the noise level or a background map.

pre_process(img)

Run self.config.data.pre_process_fct on img

save_core_offset_pos_file()

Create a core position definition object based on self.config.data.core_offset_fct and save the result on disk using path defined in self.config.data.core_offset_filename.

save_mask_file(mask_fct)

Create a mask image based on mask_fct and save the result on disk using path defined in self.config.data.mask_filename. mask_fct must be a function accepting an AnalysisContext as argument and returning a corresponding mask as libwise.imgutils.Image.

detection(img, config=None, filter=None, verbose=True)

Run detection on img (libwise.imgutils.Image).

select_files(files, start_date=None, end_date=None, filter_dates=None, step=1)

Set the images files of the projects. The files parameter accept shell like wildcards, and it is possible to filter files by dates.

Examples

>>> ctx.select_files('/project/files/*.fits')
>>> ctx.select_files('/project/files/*.fits', start_date=datetime.datetime(2000, 1, 1))
>>> ctx.select_files('/project/files/*.fits', step=2)
Parameters:
  • files (str) – Path to the file(s). Accept shell like wildcards.

  • start_date (datetime.datetime, optional) – Reject files with date < start_date.

  • end_date (datetime.datetime, optional) – Reject files with date > end_date.

  • filter_dates (a list of datetime.datetime, optional) – Reject files with date in filter_dates

  • step (int, optional)

match(find_res1, find_res2, verbose=True)

Run match on find_res1 and find_res2 (both wise.wds.SegmentedScale)