Exemplo n.º 1
0
def _init(pixel_area=0, **kwargs):
    # create dataset
    dataset = DatasetGenerator(**kwargs)
    # parse dataset
    parser = ParseEmvaDescriptorFile(dataset.descriptor_path)
    # load image data
    loader = LoadImageData(parser.images)
    # create data
    data = Data1288(loader.data)
    # Make results object
    px = pixel_area
    if pixel_area == 0:
        px = dataset.cam.pixel_area
    results = Results1288(data.data, pixel_area=px)
    return dataset, parser, loader, data, results
Exemplo n.º 2
0
 def _init(self):
     # create dataset
     dataset = DatasetGenerator(height=self._height,
                                width=self._width,
                                bit_depth=self._bit_depth,
                                L=self._L,
                                steps=self._steps,
                                radiance_min=self._radiance_min,
                                exposure_max=self._exposure_max)
     # parse dataset
     parser = ParseEmvaDescriptorFile(dataset.descriptor_path)
     # load images
     loader = LoadImageData(parser.images)
     # create data
     data = Data1288(loader.data)
     return dataset, parser, loader, data
Exemplo n.º 3
0
    def test_data_errors(self):
        # Test that given an incomplete data dictionary, it will raise errors
        # if there is no dark data in temporal
        with self.assertRaises(ValueError):
            dat = {
                'width': 1,
                'height': 1,
                'temporal': {
                    0: {
                        0.1: None
                    }
                },
                'spatial': {
                    0: {
                        0.1: None
                    }
                }
            }
            d = Data1288(dat)

        # if no dark data in spatial
        with self.assertRaises(ValueError):
            dat = {
                'width': 1,
                'height': 1,
                'temporal': {
                    0: {
                        0.0: {
                            'sum': 0,
                            'pvar': 0
                        },
                        0.1: {
                            'sum': 0,
                            'pvar': 0
                        }
                    }
                },
                'spatial': {
                    0: {
                        0.1: {
                            'sum': 0,
                            'pvar': 0
                        }
                    }
                }
            }
            d = Data1288(dat)

        # if there is no bright image for each dark
        with self.assertRaises(ValueError):
            dat = {
                'width': 1,
                'height': 1,
                'temporal': {
                    0: {
                        0.0: None
                    }
                },
                'spatial': {
                    0: {
                        0.0: None
                    }
                }
            }
            d = Data1288(dat)

        # If there is no bright image for spatial
        with self.assertRaises(ValueError):
            dat = {
                'width': 1,
                'height': 1,
                'temporal': {
                    0: {
                        0.0: {
                            'sum': 0,
                            'pvar': 0
                        },
                        0.1: {
                            'sum': 0,
                            'pvar': 0
                        }
                    }
                },
                'spatial': {
                    0: {
                        0.0: {
                            'sum': 0,
                            'pvar': 0
                        }
                    }
                }
            }
            d = Data1288(dat)

        # If there is more than 1 exposure time with spatial data
        with self.assertRaises(ValueError):
            dat = {
                'width': 1,
                'height': 1,
                'temporal': {
                    0: {
                        0.0: {
                            'sum': 0,
                            'pvar': 0
                        },
                        0.1: {
                            'sum': 0,
                            'pvar': 0
                        }
                    }
                },
                'spatial': {
                    0: {
                        0.0: {
                            'sum': 0,
                            'pvar': 0
                        },
                        0.1: {
                            'sum': 0,
                            'pvar': 0
                        }
                    },
                    1: {
                        0.0: {
                            'sum': 0,
                            'pvar': 0
                        },
                        0.1: {
                            'sum': 0,
                            'pvar': 0
                        }
                    }
                }
            }
            d = Data1288(dat)
Exemplo n.º 4
0
 def __init__(self, fname):
     parser = ParseEmvaDescriptorFile(fname)
     imgs = LoadImageData(parser.images)
     dat = Data1288(imgs.data)
     self._results = Results1288(dat.data)