Exemplo n.º 1
0
class AppVariables(object):
    browse_directory = StringDescriptor(
        'browse_directory', default_value=os.path.expanduser('~'),
        docstring='The directory for browsing for file selection.')  # type: str
    remap_type = StringDescriptor(
        'remap_type', default_value='density', docstring='')  # type: str
    image_reader = TypedDescriptor(
        'image_reader', ComplexImageReader, docstring='')  # type: ComplexImageReader
    row_line_low = IntegerDescriptor(
        'row_line_low',
        docstring='The id of the frequency_panel of the lower row bandwidth line.')  # type: Union[None, int]
    row_line_high = IntegerDescriptor(
        'row_line_high',
        docstring='The id of the frequency_panel of the upper row bandwidth line.')  # type: Union[None, int]
    col_line_low = IntegerDescriptor(
        'col_line_low',
        docstring='The id of the frequency_panel of the lower column bandwidth line.')  # type: Union[None, int]
    col_line_high = IntegerDescriptor(
        'col_line_high',
        docstring='The id of the frequency_panel of the upper column bandwidth line.')  # type: Union[None, int]
    row_deltak1 = IntegerDescriptor(
        'row_deltak1',
        docstring='The id of the frequency_panel of the row deltak1 line.')  # type: Union[None, int]
    row_deltak2 = IntegerDescriptor(
        'row_deltak2',
        docstring='The id of the frequency_panel of the row deltak2 line.')  # type: Union[None, int]
    col_deltak1 = IntegerDescriptor(
        'col_deltak1',
        docstring='The id of the frequency_panel of the column deltak1.')  # type: Union[None, int]
    col_deltak2 = IntegerDescriptor(
        'col_deltak2',
        docstring='The id of the frequency_panel of the column deltak2.')  # type: Union[None, int]
Exemplo n.º 2
0
class AppVariables(object):
    browse_directory = StringDescriptor(
        'browse_directory',
        default_value=os.path.expanduser('~'),
        docstring='The directory for browsing for file selection.'
    )  # type: str
    remap_type = StringDescriptor('remap_type',
                                  default_value='density',
                                  docstring='')  # type: str
    image_reader = TypedDescriptor('image_reader', ImageReader,
                                   docstring='')  # type: ImageReader
Exemplo n.º 3
0
class AppVariables(object):
    browse_directory = StringDescriptor(
        'browse_directory',
        default_value=os.path.expanduser('~'),
        docstring='The directory for browsing for file selection.'
    )  # type: str
    remap_type = StringDescriptor('remap_type',
                                  default_value='density',
                                  docstring='')  # type: str
    image_reader = TypedDescriptor('image_reader',
                                   ComplexImageReader,
                                   docstring='')  # type: ComplexImageReader

    row_fourier_reader = TypedDescriptor(
        'row_fourier_reader',
        ComplexImageReader,
        docstring='The row deskewed fourier transformed reader'
    )  # type: ComplexImageReader
    row_fourier_file = StringDescriptor(
        'row_fourier_file',
        docstring='The row deskewed fourier transformed reader file'
    )  # type: str
    # NB: we are saving this state in order to properly clean up
    column_fourier_reader = TypedDescriptor(
        'column_fourier_reader',
        ComplexImageReader,
        docstring='The column deskewed fourier transformed reader'
    )  # type: ComplexImageReader
    column_fourier_file = StringDescriptor(
        'row_fourier_file',
        docstring='The column deskewed fourier transformed reader file'
    )  # type: str
    # NB: we are saving this state in order to properly clean up

    derived_row_weights = None  # the derived weights for the row
    scaled_row_mean = None  # the scaled mean Fourier transform of the row deskewed data
    derived_column_weights = None  # the derived weights for the column
    scaled_column_mean = None  # the scaled mean Fourier transform of the column deskewed data

    def __del__(self):
        # clean up files, because we might need to do so
        if self.row_fourier_file is not None \
                and os.path.exists(self.row_fourier_file):
            os.remove(self.row_fourier_file)
            logger.debug('(variables) Removing temp file % s' %
                         self.row_fourier_file)
            self.row_fourier_file = None

        if self.column_fourier_file is not None and \
                os.path.exists(self.column_fourier_file):
            os.remove(self.column_fourier_file)
            logger.debug('(variables)  Removing temp file % s' %
                         self.column_fourier_file)
            self.column_fourier_file = None
Exemplo n.º 4
0
class AppVariables(object):
    current_id = StringDescriptor('current_id',
                                  default_value=None)  # type: Union[None, str]
    unsaved_edits = BooleanDescriptor('unsaved_edits',
                                      default_value=False)  # type: bool
    browse_directory = StringDescriptor(
        'browse_directory',
        default_value=os.path.expanduser('~'),
        docstring='The directory for browsing for file selection.'
    )  # type: str
    label_file_name = StringDescriptor(
        'label_file_name', default_value=None)  # type: Union[None, str]
    label_schema = TypedDescriptor('label_schema',
                                   LabelSchema)  # type: LabelSchema
Exemplo n.º 5
0
class AppVariables(object):
    """
    App variables for the aperture tool.
    """

    browse_directory = StringDescriptor(
        'browse_directory',
        default_value=os.path.expanduser('~'),
        docstring='The directory for browsing for file selection.'
    )  # type: str
    image_reader = TypedDescriptor(
        'image_reader',
        STFTCanvasImageReader,
        docstring='The crsd type canvas image reader object.'
    )  # type: STFTCanvasImageReader
    animating = BooleanDescriptor(
        'animating',
        default_value=False,
        docstring='Are we currently looping through pulses?')  # type: bool
    animation_delay = IntegerDescriptor(
        'animation_delay',
        default_value=30,
        docstring='Animation delay in milliseconds')  # type: int
    vmin = FloatDescriptor('vmin', default_value=0)  # type: float
    vmax = FloatDescriptor('vmax', default_value=0)  # type: float
    vcount = IntegerDescriptor('vcount', default_value=0)  # type: int
Exemplo n.º 6
0
class AppVariables(CanvasAppVariables):
    """
    The canvas image application variables.
    """

    title = StringDescriptor('title', default_value="", docstring='')  # type: str
    x_label = StringDescriptor('x_label', default_value="", docstring='')  # type: str
    y_label = StringDescriptor('y_label', default_value="", docstring='')  # type: str
    image_x_start = FloatDescriptor('image_x_start', default_value=None)  # type: int
    image_x_end = FloatDescriptor('image_x_end', default_value=None)  # type: int
    image_y_start = FloatDescriptor('image_y_start', default_value=None)  # type: int
    image_y_end = FloatDescriptor('image_y_end', default_value=None)  # type: int
    top_margin = IntegerDescriptor('top_margin', default_value=0)  # type: int
    bottom_margin = IntegerDescriptor('bottom_margin', default_value=0)  # type: int
    left_margin = IntegerDescriptor('left_margin', default_value=0)  # type: int
    right_margin = IntegerDescriptor('right_margin', default_value=0)  # type: int
    n_x_axis_ticks = IntegerDescriptor('n_x_axis_ticks', default_value=5)  # type: int
    n_y_axis_ticks = IntegerDescriptor('n_y_axis_ticks', default_value=5)  # type: int
Exemplo n.º 7
0
class AppVariables(object):
    browse_directory = StringDescriptor(
        'browse_directory', default_value=os.path.expanduser('~'),
        docstring='The initial opening directory. This will get updated on chosen file.')  # type: str
    image_reader = TypedDescriptor(
        'image_reader', ComplexImageReader, docstring='')  # type: ComplexImageReader
    arrow_id = IntegerDescriptor(
        'arrow_id', docstring='')  # type: int
    point_id = IntegerDescriptor(
        'point_id', docstring='')  # type: int
    horizontal_line_id = IntegerDescriptor(
        'horizontal_line_id', docstring='')  # type: int
    line_width = IntegerDescriptor(
        'line_width', default_value=3, docstring='')  # type: int
    horizontal_line_width = IntegerDescriptor(
        'horizontal_line_width', default_value=3, docstring='')  # type: int
    horizontal_line_color = StringDescriptor(
        'horizontal_line_color', default_value='green',
        docstring='A hexidecimal or named color.')  # type: str
Exemplo n.º 8
0
class AppVariables(object):
    """
    The canvas demo app variables.
    """

    browse_directory = StringDescriptor(
        'browse_directory', default_value=os.path.expanduser('~'))  # type: str
    selection_rect_id = IntegerDescriptor('selection_rect_id',
                                          docstring='')  # type: int
    image_reader = TypedDescriptor('image_reader',
                                   ComplexImageReader,
                                   docstring='')  # type: ComplexImageReader

    def __init__(self):
        self.shapes_in_selector = []
Exemplo n.º 9
0
class AppVariables(AppVariables_Annotate):
    file_annotation_collection = TypedDescriptor(
        'file_annotation_collection',
        FileRCSCollection,
        docstring='The file annotation collection.')  # type: FileRCSCollection
    image_reader = TypedDescriptor(
        'image_reader', SICDTypeCanvasImageReader,
        docstring='')  # type: SICDTypeCanvasImageReader
    rcs_viewer_units = StringDescriptor('rcs_viewer_units',
                                        default_value='')  # type: str

    def get_current_annotation_object(self):
        """
        Gets the current annotation object

        Returns
        -------
        None|RCSFeature
        """

        if self._current_feature_id is None:
            return None
        return self.file_annotation_collection.annotations[
            self._current_feature_id]

    def get_rcs_units(self):
        if self.image_reader is None:
            return []

        sicd = self.image_reader.get_sicd()
        if sicd.Radiometric is None:
            return ['TotalPixelPower', 'PixelPower']
        else:
            return [
                'TotalRCS', 'PixelPower', 'RCS', 'BetaZero', 'GammaZero',
                'SigmaZero'
            ]