Example #1
0
    def _getFilterIdInPhoSim(self):
        """Get the active filter Id used in PhoSim.

        Returns
        -------
        int
            Active filter ID in PhoSim.
        """

        filterType = self.surveyParam["filterType"]
        mappedFilterType = mapFilterRefToG(filterType)

        return self.phoSimCommu.getFilterId(mappedFilterType)
Example #2
0
    def getTargetStarByFile(self, skyFilePath, offset=0):
        """Get the target stars by querying the star file.

        This function is only for the test. This shall be removed in the final.

        Parameters
        ----------
        skyFilePath : str
            Sky data file path.
        offset : float, optional
            Offset to the dimension of camera. If the detector dimension is 10
            (assume 1-D), the star's position between -offset and 10+offset
            will be seem to be on the detector. (the default is 0.)

        Returns
        -------
        dict
            Information of neighboring stars and candidate stars with the name
            of sensor as a dictionary.
        dict
            Information of stars with the name of sensor as a dictionary.
        dict
            (ra, dec) of four corners of each sensor with the name
            of sensor as a list. The dictionary key is the sensor name.

        Raises
        ------
        TypeError
            The database type is incorrect.
        """

        if not isinstance(self.db, LocalDatabaseForStarFile):
            raise TypeError("The database type is incorrect.")

        # Map the reference filter to the G filter
        filterType = self.getFilter()
        mappedFilterType = mapFilterRefToG(filterType)

        # Write the sky data into the temporary table
        self.db.createTable(mappedFilterType)
        self.db.insertDataByFile(skyFilePath, mappedFilterType, skiprows=1)
        neighborStarMap, starMap, wavefrontSensors = self.getTargetStar(
            offset=offset)

        # Delete the table
        self.db.deleteTable(mappedFilterType)

        return neighborStarMap, starMap, wavefrontSensors
Example #3
0
    def getMagBoundary(self):
        """Get the boundary of magnitude under the current filter type.

        Returns
        -------
        float
            Lower boundary of magnitude.
        float
            Higher boundary of magnitude.

        Raises
        ------
        ValueError
            No filter type matches.
        """

        lowMagnitude = 0
        highMagnitude = 0

        mappedFilterType = mapFilterRefToG(self.filter)
        if (mappedFilterType == FilterType.U):
            lowMagnitude = self.U_LOW_MAG
            highMagnitude = self.U_HIGH_MAG

        elif (mappedFilterType == FilterType.G):
            lowMagnitude = self.G_LOW_MAG
            highMagnitude = self.G_HIGH_MAG

        elif (mappedFilterType == FilterType.R):
            lowMagnitude = self.R_LOW_MAG
            highMagnitude = self.R_HIGH_MAG

        elif (mappedFilterType == FilterType.I):
            lowMagnitude = self.I_LOW_MAG
            highMagnitude = self.I_HIGH_MAG

        elif (mappedFilterType == FilterType.Z):
            lowMagnitude = self.Z_LOW_MAG
            highMagnitude = self.Z_HIGH_MAG

        elif (mappedFilterType == FilterType.Y):
            lowMagnitude = self.Y_LOW_MAG
            highMagnitude = self.Y_HIGH_MAG

        else:
            raise ValueError("No filter type matches.")

        return lowMagnitude, highMagnitude
Example #4
0
    def getTargetStarByFile(self, skyFilePath, offset=0):
        """Get the target stars by querying the star file.

        This function is only for the test. This shall be removed in the final.

        Parameters
        ----------
        skyFilePath : str
            Sky data file path.
        offset : float, optional
            Offset to the dimension of camera. If the detector dimension is 10
            (assume 1-D), the star's position between -offset and 10+offset
            will be seem to be on the detector. (the default is 0.)

        Returns
        -------
        dict
            Information of neighboring stars and candidate stars with the name
            of sensor as a dictionary.
        dict
            Information of stars with the name of sensor as a dictionary.
        dict
            (ra, dec) of four corners of each sensor with the name
            of sensor as a list. The dictionary key is the sensor name.

        Raises
        ------
        TypeError
            The database type is incorrect.
        """

        if (not isinstance(self.db, LocalDatabaseForStarFile)):
            raise TypeError("The database type is incorrect.")

        # Map the reference filter to the G filter
        filterType = self.getFilter()
        mappedFilterType = mapFilterRefToG(filterType)

        # Write the sky data into the temporary table
        self.db.createTable(mappedFilterType)
        self.db.insertDataByFile(skyFilePath, mappedFilterType, skiprows=1)
        neighborStarMap, starMap, wavefrontSensors = self.getTargetStar(offset=offset)

        # Delete the table
        self.db.deleteTable(mappedFilterType)

        return neighborStarMap, starMap, wavefrontSensors
Example #5
0
    def getMagBoundary(self):
        """Get the boundary of magnitude under the current filter type.

        Returns
        -------
        float
            Lower boundary of magnitude.
        float
            Higher boundary of magnitude.

        Raises
        ------
        ValueError
            No filter type matches.
        """

        mappedFilterType = mapFilterRefToG(self.filter)
        if mappedFilterType == FilterType.U:
            filterName = "filterU"

        elif mappedFilterType == FilterType.G:
            filterName = "filterG"

        elif mappedFilterType == FilterType.R:
            filterName = "filterR"

        elif mappedFilterType == FilterType.I:
            filterName = "filterI"

        elif mappedFilterType == FilterType.Z:
            filterName = "filterZ"

        elif mappedFilterType == FilterType.Y:
            filterName = "filterY"

        else:
            raise ValueError("No filter type matches.")

        rangeMag = self._fileMagLimitStar.getSetting(filterName)

        return rangeMag["low"], rangeMag["high"]
Example #6
0
    def getTargetStar(self, offset=0):
        """Get the target stars by querying the database.

        Parameters
        ----------
        offset : float, optional
            Offset to the dimension of camera. If the detector dimension is 10
            (assume 1-D), the star's position between -offset and 10+offset
            will be seem to be on the detector. (the default is 0.)

        Returns
        -------
        dict
            Information of neighboring stars and candidate stars with the name
            of sensor as a dictionary.
        dict
            Information of stars with the name of sensor as a dictionary.
        dict
            (ra, dec) of four corners of each sensor with the name
            of sensor as a list. The dictionary key is the sensor name.
        """

        wavefrontSensors = self.camera.getWavefrontSensor()
        lowMagnitude, highMagnitude = self.filter.getMagBoundary()

        # Map the reference filter to the G filter
        filterType = self.getFilter()
        mappedFilterType = mapFilterRefToG(filterType)

        # Query the star database
        starMap = dict()
        neighborStarMap = dict()
        for detector, wavefrontSensor in wavefrontSensors.items():

            # Get stars in this wavefront sensor for this observation field
            stars = self.db.query(
                mappedFilterType,
                wavefrontSensor[0],
                wavefrontSensor[1],
                wavefrontSensor[2],
                wavefrontSensor[3],
            )

            # Set the detector information for the stars
            stars.setDetector(detector)

            # Populate pixel information for stars
            populatedStar = self.camera.populatePixelFromRADecl(stars)

            # Get the stars that are on the detector
            starsOnDet = self.camera.getStarsOnDetector(populatedStar, offset)
            starMap[detector] = starsOnDet

            # Check the candidate of bright stars based on the magnitude
            indexCandidate = starsOnDet.checkCandidateStars(
                mappedFilterType, lowMagnitude, highMagnitude)

            # Determine the neighboring stars based on the distance and
            # allowed number of neighboring stars
            neighborStar = starsOnDet.getNeighboringStar(
                indexCandidate,
                self.maxDistance,
                mappedFilterType,
                self.maxNeighboringStar,
            )
            neighborStarMap[detector] = neighborStar

        # Remove the data that has no bright star
        self._rmDataWithoutBrightStar(neighborStarMap, starMap,
                                      wavefrontSensors)

        return neighborStarMap, starMap, wavefrontSensors
Example #7
0
    def getSingleTargetImage(self, ccdImg, nbrStar, index, filterType):
        """Get the image of single scientific target and related neighboring
        stars.

        Parameters
        ----------
        ccdImg : numpy.ndarray
            CCD image.
        nbrStar : NbrStar
            Neighboring star on single detector.
        index : int
            Index of science target star in neighboring star.
        filterType : FilterType
            Filter type.

        Returns
        -------
        numpy.ndarray
            Ccd image of target stars.
        numpy.ndarray
            Star positions in x. The arange is [neighboring stars, bright star].
        numpy.ndarray
            Star positions in y. The arange is [neighboring stars, bright star].
        numpy.ndarray
            Star magnitude ratio compared with the bright star. The arange is
            [neighboring stars, bright star].
        float
            Offset x from the origin of target star image to the origin of CCD
            image.
        float
            Offset y from the origin of target star image to the origin of CCD
            image.

        Raises
        ------
        ValueError
            Index is higher than the length of star map.
        """

        # Get the target star position
        nbrStarId = nbrStar.getId()
        if (index >= len(nbrStarId)):
            raise ValueError("Index is higher than the length of star map.")

        # Get the star SimobjID
        brightStar = list(nbrStarId)[index]
        neighboringStar = nbrStarId[brightStar]

        # Get all star SimobjID list
        allStar = neighboringStar[:]
        allStar.append(brightStar)

        # Get the pixel positions
        raDeclInPixel = nbrStar.getRaDeclInPixel()
        allStarPosX = []
        allStarPosY = []
        for star in allStar:

            # Get the star pixel position
            starX, starY = raDeclInPixel[star]

            # Transform the coordiante from DM team to camera team
            starX, starY = self.dmXY2CamXY(starX, starY)

            allStarPosX.append(starX)
            allStarPosY.append(starY)

        # Check the ccd image dimenstion
        ccdD1, ccdD2 = ccdImg.shape

        # Define the range of image
        # Get min/ max of x, y
        minX = int(min(allStarPosX))
        maxX = int(max(allStarPosX))

        minY = int(min(allStarPosY))
        maxY = int(max(allStarPosY))

        # Get the central point
        cenX = int(np.mean([minX, maxX]))
        cenY = int(np.mean([minY, maxY]))

        # Get the image dimension
        d1 = (maxY - minY) + 4 * self.STAR_RADIUS_IN_PIXEL
        d2 = (maxX - minX) + 4 * self.STAR_RADIUS_IN_PIXEL

        # Make d1 and d2 to be symmetric and even
        d = max(d1, d2)
        if (d % 2 == 1):
            # Use d-1 instead of d+1 to avoid the boundary touch
            d = d - 1

        # Compare the distances from the central point to four boundaries of
        # ccd image
        cenYup = ccdD1 - cenY
        cenXright = ccdD2 - cenX

        # If central x or y plus d/2 will over the boundary, shift the
        # central x, y values
        cenY = self._shiftCenter(cenY, ccdD1, d / 2)
        cenY = self._shiftCenter(cenY, 0, d / 2)

        cenX = self._shiftCenter(cenX, ccdD2, d / 2)
        cenX = self._shiftCenter(cenX, 0, d / 2)

        # Get the bright star and neighboring stas image
        offsetX = cenX - d / 2
        offsetY = cenY - d / 2
        singleSciNeiImg = \
                ccdImg[int(offsetY):int(cenY + d / 2),
                       int(offsetX):int(cenX + d / 2)]

        # Get the stars position in the new coordinate system
        # The final one is the bright star
        allStarPosX = np.array(allStarPosX) - offsetX
        allStarPosY = np.array(allStarPosY) - offsetY

        # Get the star magnitude
        mappedFilterType = mapFilterRefToG(filterType)
        magList = nbrStar.getMag(mappedFilterType)

        # Get the list of magnitude
        magRatio = np.array([])
        for star in allStar:
            neiMag = magList[star]
            magRatio = np.append(magRatio, neiMag)

        # Calculate the magnitude ratio
        magRatio = 1 / 100**((magRatio - magRatio[-1]) / 5.0)

        return singleSciNeiImg, allStarPosX, allStarPosY, magRatio, offsetX, \
               offsetY
Example #8
0
    def simulateImg(self,
                    imageFolderPath,
                    defocalDis,
                    nbrStar,
                    filterType,
                    noiseRatio=0.01):
        """Simulate the defocal CCD images with the neighboring star map.

        This function is only for the test use.

        Parameters
        ----------
        imageFolderPath : str
            Path to image directory.
        defocalDis : float
            Defocal distance in mm.
        nbrStar : NbrStar
            Neighboring star on single detector.
        filterType : FilterType
            Filter type.
        noiseRatio : float, optional
            The noise ratio. (the default is 0.01.)

        Returns
        -------
        numpy.ndarray
            Simulated intra-focal images.
        numpy.ndarray
            Simulated extra-focal images.

        Raises
        -------
        ValueError
            No available donut images.
        ValueError
            The numbers of intra- and extra-focal images are different.
        """

        # Generate the intra- and extra-focal ccd images
        d1, d2 = self.sensorDimList[self.sensorName]
        ccdImgIntra = np.random.random([d2, d1]) * noiseRatio
        ccdImgExtra = ccdImgIntra.copy()

        # Get all files in the image directory in a sorted order
        fileList = sorted(os.listdir(imageFolderPath))

        # Redefine the format of defocal distance
        defocalDis = "%.2f" % defocalDis

        # Get the available donut files
        intraFileList = []
        extraFileList = []
        for afile in fileList:

            # Get the file name
            fileName, fileExtension = os.path.splitext(afile)

            # Split the file name for the analysis
            fileNameStr = fileName.split("_")

            # Find the file name with the correct defocal distance
            if (len(fileNameStr) == 3 and fileNameStr[1] == defocalDis):

                # Collect the file name based on the defocal type
                if (fileNameStr[-1] == "intra"):
                    intraFileList.append(afile)
                elif (fileNameStr[-1] == "extra"):
                    extraFileList.append(afile)

        # Get the number of available files
        numFile = len(intraFileList)
        if (numFile == 0):
            raise ValueError("No available donut images.")

        # Check the numbers of intra- and extra-focal images should be the same
        if (numFile != len(extraFileList)):
            raise ValueError(
                "The numbers of intra- and extra-focal images are different.")

        # Get the magnitude of stars
        mappedFilterType = mapFilterRefToG(filterType)
        starMag = nbrStar.getMag(mappedFilterType)

        # Based on the nbrStar to reconstruct the image
        for brightStar, neighboringStar in nbrStar.getId().items():

            # Generate a random number
            randNum = np.random.randint(0, high=numFile)

            # Choose a random donut image from the file
            donutImageIntra = self._getDonutImgFromFile(
                imageFolderPath, intraFileList[randNum])
            donutImageExtra = self._getDonutImgFromFile(
                imageFolderPath, extraFileList[randNum])

            # Get the bright star magnitude
            magBS = starMag[brightStar]

            # Combine the bright star and neighboring stars. Put the bright
            # star in the first one.
            allStars = neighboringStar[:]
            allStars.insert(0, brightStar)

            # Add the donut image
            for star in allStars:

                # Get the brigtstar pixel x, y
                starX, starY = nbrStar.getRaDeclInPixel()[star]
                magStar = starMag[star]

                # Transform the coordiante from DM team to camera team
                starX, starY = self.dmXY2CamXY(starX, starY)

                # Ratio of magnitude between donuts (If the magnitudes of stars
                # differs by 5, the brightness differs by 100.)
                # (Magnitude difference shoulbe be >= 1.)
                magDiff = magStar - magBS
                magRatio = 1 / 100**(magDiff / 5.0)

                # Add the donut image
                self._addDonutImage(magRatio * donutImageIntra, starX, starY,
                                    ccdImgIntra)
                self._addDonutImage(magRatio * donutImageExtra, starX, starY,
                                    ccdImgExtra)

        return ccdImgIntra, ccdImgExtra
Example #9
0
    def testMapFilterRefToGForFilterU(self):

        mappedFilterType = mapFilterRefToG(FilterType.U)
        self.assertEqual(mappedFilterType, FilterType.U)
Example #10
0
    def testMapFilterRefToG(self):

        mappedFilterType = mapFilterRefToG(FilterType.REF)
        self.assertEqual(mappedFilterType, FilterType.G)
Example #11
0
    def testmapFilterRefToGForFilterU(self):

        mappedFilterType = mapFilterRefToG(FilterType.U)
        self.assertEqual(mappedFilterType, FilterType.U)
Example #12
0
    def testmapFilterRefToG(self):

        mappedFilterType = mapFilterRefToG(FilterType.REF)
        self.assertEqual(mappedFilterType, FilterType.G)
Example #13
0
    def getSingleTargetImage(self, ccdImg, nbrStar, index, filterType):
        """Get the image of single scientific target and related neighboring
        stars.

        Parameters
        ----------
        ccdImg : numpy.ndarray
            CCD image.
        nbrStar : NbrStar
            Neighboring star on single detector.
        index : int
            Index of science target star in neighboring star.
        filterType : FilterType
            Filter type.

        Returns
        -------
        numpy.ndarray
            Ccd image of target stars.
        numpy.ndarray
            Star x-positions. The arange is [neighboring stars, bright star].
        numpy.ndarray
            Star y-positions. The arange is [neighboring stars, bright star].
        numpy.ndarray
            Star magnitude ratio compared with the bright star. The arange is
            [neighboring stars, bright star].
        float
            Offset x from the origin of target star image to the origin of CCD
            image.
        float
            Offset y from the origin of target star image to the origin of CCD
            image.

        Raises
        ------
        ValueError
            Index is higher than the length of star map.
        """

        # Get the target star position
        nbrStarId = nbrStar.getId()
        if (index >= len(nbrStarId)):
            raise ValueError("Index is higher than the length of star map.")

        # Get the star SimobjID
        brightStar = list(nbrStarId)[index]
        neighboringStar = nbrStarId[brightStar]

        # Get all star SimobjID list
        allStar = neighboringStar[:]
        allStar.append(brightStar)

        # Get the pixel positions
        raDeclInPixel = nbrStar.getRaDeclInPixel()
        allStarPosX = []
        allStarPosY = []
        for star in allStar:

            # Get the star pixel position
            starX, starY = raDeclInPixel[star]

            # Transform the coordiante from DM team to camera team
            starX, starY = self.dmXY2CamXY(starX, starY)

            allStarPosX.append(starX)
            allStarPosY.append(starY)

        # Check the ccd image dimenstion
        ccdD1, ccdD2 = ccdImg.shape

        # Define the range of image
        # Get min/ max of x, y
        minX = int(min(allStarPosX))
        maxX = int(max(allStarPosX))

        minY = int(min(allStarPosY))
        maxY = int(max(allStarPosY))

        # Get the central point
        cenX = int(np.mean([minX, maxX]))
        cenY = int(np.mean([minY, maxY]))

        # Get the image dimension
        starRadiusInPixel = self.settingFile.getSetting("starRadiusInPixel")
        d1 = (maxY - minY) + 4 * starRadiusInPixel
        d2 = (maxX - minX) + 4 * starRadiusInPixel

        # Make d1 and d2 to be symmetric and even
        d = max(d1, d2)
        if (d%2 == 1):
            # Use d-1 instead of d+1 to avoid the boundary touch
            d = d-1

        # If central x or y plus d/2 will over the boundary, shift the
        # central x, y values
        cenY = self._shiftCenter(cenY, ccdD1, d / 2)
        cenY = self._shiftCenter(cenY, 0, d / 2)

        cenX = self._shiftCenter(cenX, ccdD2, d / 2)
        cenX = self._shiftCenter(cenX, 0, d / 2)

        # Get the bright star and neighboring stas image
        offsetX = cenX - d / 2
        offsetY = cenY - d / 2
        singleSciNeiImg = \
            ccdImg[int(offsetY):int(cenY + d / 2), int(offsetX):int(cenX + d / 2)]

        # Get the stars position in the new coordinate system
        # The final one is the bright star
        allStarPosX = np.array(allStarPosX) - offsetX
        allStarPosY = np.array(allStarPosY) - offsetY

        # Get the star magnitude
        mappedFilterType = mapFilterRefToG(filterType)
        magList = nbrStar.getMag(mappedFilterType)

        # Get the list of magnitude
        magRatio = np.array([])
        for star in allStar:
            neiMag = magList[star]
            magRatio = np.append(magRatio, neiMag)

        # Calculate the magnitude ratio
        magRatio = 1 / 100 ** ((magRatio - magRatio[-1]) / 5.0)

        return singleSciNeiImg, allStarPosX, allStarPosY, magRatio, offsetX, offsetY
Example #14
0
    def simulateImg(self, imageFolderPath, defocalDis, nbrStar, filterType,
                    noiseRatio=0.01):
        """Simulate the defocal CCD images with the neighboring star map.

        This function is only for the test use.

        Parameters
        ----------
        imageFolderPath : str
            Path to image directory.
        defocalDis : float
            Defocal distance in mm.
        nbrStar : NbrStar
            Neighboring star on single detector.
        filterType : FilterType
            Filter type.
        noiseRatio : float, optional
            The noise ratio. (the default is 0.01.)

        Returns
        -------
        numpy.ndarray
            Simulated intra-focal images.
        numpy.ndarray
            Simulated extra-focal images.

        Raises
        -------
        ValueError
            No available donut images.
        ValueError
            The numbers of intra- and extra-focal images are different.
        """

        # Generate the intra- and extra-focal ccd images
        d1, d2 = self.sensorDimList[self.sensorName]
        ccdImgIntra = np.random.random([d2, d1])*noiseRatio
        ccdImgExtra = ccdImgIntra.copy()

        # Get all files in the image directory in a sorted order
        fileList = sorted(os.listdir(imageFolderPath))

        # Redefine the format of defocal distance
        defocalDis = "%.2f" % defocalDis

        # Get the available donut files
        intraFileList = []
        extraFileList = []
        for afile in fileList:

            # Get the file name
            fileName, fileExtension = os.path.splitext(afile)

            # Split the file name for the analysis
            fileNameStr = fileName.split("_")

            # Find the file name with the correct defocal distance
            if (len(fileNameStr) == 3 and fileNameStr[1] == defocalDis):

                # Collect the file name based on the defocal type
                if (fileNameStr[-1] == "intra"):
                    intraFileList.append(afile)
                elif (fileNameStr[-1] == "extra"):
                    extraFileList.append(afile)

        # Get the number of available files
        numFile = len(intraFileList)
        if (numFile == 0):
            raise ValueError("No available donut images.")

        # Check the numbers of intra- and extra-focal images should be the same
        if (numFile != len(extraFileList)):
            raise ValueError(
                "The numbers of intra- and extra-focal images are different.")

        # Get the magnitude of stars
        mappedFilterType = mapFilterRefToG(filterType)
        starMag = nbrStar.getMag(mappedFilterType)

        # Based on the nbrStar to reconstruct the image
        for brightStar, neighboringStar in nbrStar.getId().items():

            # Generate a random number
            randNum = np.random.randint(0, high=numFile)

            # Choose a random donut image from the file
            donutImageIntra = self._getDonutImgFromFile(
                imageFolderPath, intraFileList[randNum])
            donutImageExtra = self._getDonutImgFromFile(
                imageFolderPath, extraFileList[randNum])

            # Get the bright star magnitude
            magBS = starMag[brightStar]

            # Combine the bright star and neighboring stars. Put the bright
            # star in the first one.
            allStars = neighboringStar[:]
            allStars.insert(0, brightStar)

            # Add the donut image
            for star in allStars:

                # Get the brigtstar pixel x, y
                starX, starY = nbrStar.getRaDeclInPixel()[star]
                magStar = starMag[star]

                # Transform the coordiante from DM team to camera team
                starX, starY = self.dmXY2CamXY(starX, starY)

                # Ratio of magnitude between donuts (If the magnitudes of stars
                # differs by 5, the brightness differs by 100.)
                # (Magnitude difference shoulbe be >= 1.)
                magDiff = magStar - magBS
                magRatio = 1 / 100 ** (magDiff / 5.0)

                # Add the donut image
                self._addDonutImage(magRatio * donutImageIntra, starX, starY,
                                    ccdImgIntra)
                self._addDonutImage(magRatio * donutImageExtra, starX, starY,
                                    ccdImgExtra)

        return ccdImgIntra, ccdImgExtra
Example #15
0
    def getTargetStar(self, offset=0):
        """Get the target stars by querying the database.

        Parameters
        ----------
        offset : float, optional
            Offset to the dimension of camera. If the detector dimension is 10
            (assume 1-D), the star's position between -offset and 10+offset
            will be seem to be on the detector. (the default is 0.)

        Returns
        -------
        dict
            Information of neighboring stars and candidate stars with the name
            of sensor as a dictionary.
        dict
            Information of stars with the name of sensor as a dictionary.
        dict
            (ra, dec) of four corners of each sensor with the name
            of sensor as a list. The dictionary key is the sensor name.
        """

        wavefrontSensors = self.camera.getWavefrontSensor()
        lowMagnitude, highMagnitude = self.filter.getMagBoundary()

        # Map the reference filter to the G filter
        filterType = self.getFilter()
        mappedFilterType = mapFilterRefToG(filterType)

        # Query the star database
        starMap = dict()
        neighborStarMap = dict()
        for detector, wavefrontSensor in wavefrontSensors.items():

            # Get stars in this wavefront sensor for this observation field
            stars = self.db.query(mappedFilterType, wavefrontSensor[0],
                                  wavefrontSensor[1], wavefrontSensor[2],
                                  wavefrontSensor[3])

            # Set the detector information for the stars
            stars.setDetector(detector)

            # Populate pixel information for stars
            populatedStar = self.camera.populatePixelFromRADecl(stars)

            # Get the stars that are on the detector
            starsOnDet = self.camera.getStarsOnDetector(populatedStar, offset)
            starMap[detector] = starsOnDet

            # Check the candidate of bright stars based on the magnitude
            indexCandidate = starsOnDet.checkCandidateStars(
                mappedFilterType, lowMagnitude, highMagnitude)

            # Determine the neighboring stars based on the distance and
            # allowed number of neighboring stars
            neighborStar = starsOnDet.getNeighboringStar(
                indexCandidate, self.maxDistance, mappedFilterType,
                self.maxNeighboringStar)
            neighborStarMap[detector] = neighborStar

        # Remove the data that has no bright star
        self._rmDataWithoutBrightStar(neighborStarMap, starMap,
                                      wavefrontSensors)

        return neighborStarMap, starMap, wavefrontSensors