5.2. incNET.py

incNET.converIMAGE(img_arr, angle=0.0, scale=1.0, size=64)

Converting an image array anlgle: how much to rotate the image scale: scale of the output image

zoomin out if sale<1 and zooming in if scale>1

size: the number of pixels on each side of the output image

Parameters
  • img_arr (numpy ndarray) – input image

  • angle (int, optional) – image rotation in degrees, defaults to 0.

  • scale (int, optional) – the scale of the output image relative to the input image, defaults to 1.

  • size (int, optional) – resolution of the output image in pixel, defaults to 64

Returns

output image

Return type

PIL image object

incNET.model(params, myModels, saveRescaled=True, scaledImage=None)

providing the input parameters and a set of TensorFlow models, this function iterates through all models and parses the predictions in separate python dictionaries

Parameters
  • params (python dictionary) – input parameters

  • myModels (TensorFlow models organized in a python dictionary) – ML predictors, a dictionary of models

  • saveRescaled (bool, optional) – save the rescaled image?, defaults to True

  • scaledImage (str, optional) – name of the rescaled image, defaults to None

Returns

evalINCs: python dictionary containing all evaluated inclinations evalRej: python dictionary containing all rejection likelihoods

Return type

tuple (evalINCs, evalRej)

incNET.model2html(params, myModels)

parsing the output results in html format Given a set of parameters, all evaluations are carried out and returned in html format for the use in the online GUI.

Parameters
  • params (python dictionary) – input parameter set

  • myModels (python dictionary) – TensorFlow models organized in a python dictionary

Returns

a summary of all evaluations

Return type

html text

incNET.openImage(params)

importing the image and preparing it for the analysis

Parameters

params (python dictionary) – a set of parameters including the name of the file that contains the image

Returns

(image_array, scale, angle)

Return type

tuple

image_array: numpy ndarray holding the image angle: how much to rotate the image scale: scale of the output image

incNET.predictor(model, All_images)

The prediction of the regression model This model returns the galaxy inclinations of the input galaxy images.

All_images usually hold the images of the same galaxy projected at 4 different position angles, 90 degrees apart.

Parameters
  • model (A convolutional neural network in TensorFlow) – regression model

  • All_images (numpy ndarray with the shape (N, size, size, n_channels=3)) – N images to be evaluated

Returns

the median of all evaluated inclinations

Return type

float

incNET.predictor_binary(model, All_images)

The prediction of the classification model This model returns a number between 0 and 1, which corresponds to the likelihood of the users rejecting this image, because of poor quality, bright star in the field, etc.

All_images hold the images of the same galaxy projected at 4 different position angles, 90 degrees apart.

Parameters
  • model (A convolutional neural network in TensorFlow) – classification model

  • All_images (numpy ndarray with the shape (N, size, size, n_channels=3)) – N images to be evaluated

Returns

the median of all evaluated rejection likelihoods

Return type

float

incNET.scaleFileName(params)

generating the name of the scaled image based on the name of the input image and the time stamp of the analysis

Parameters

params (python dictionary) – a set of parameters including the name of the desired image to be rescaled

Returns

the name of the scaled image

Return type

string