ProFound is an R package designed to automatically detect and extract astronomical objects from images. If you have an image (like a telescope observation), ProFound can:
Think of it as a “find all the things in this picture” tool, with sophisticated algorithms to handle real astronomical data.
Typical use cases:
profoundProFound()The core of ProFound is the profoundProFound() function.
Most of the time, this is the only function you need to know about.
The simplest form requires just an image:
That’s it! ProFound will: 1. Estimate the background sky level 2. Find connected regions above a threshold 3. Clean up the detections 4. Measure properties of each object 5. Return a list with all the results
The image: - Must be a 2D matrix or array of pixel
values - Typically read from a FITS file (use
Rfits_read_image() from the Rfits package) -
Can be from any telescope or camera
The most useful output is result$segstats, a data frame
containing detected objects and various useful properties,
including:
segID: Unique ID for each objectx, y: Centre position (in pixels)N100: Number of pixels in the objectflux: Total brightness (in ADU or counts)mag: Magnitude (if magzero is set properly
this will be in AB mag)R50: Size of the object (radius containg 50% of the
flux)ProFound has many parameters, but most have sensible defaults. Here are the ones you might adjust:
skycut and pixcutThese control how aggressively ProFound detects objects:
skycut (default: 1.5): Detected
objects must be this many times the sky noise above the backgroundpixcut (default: 3): Minimum number of
connected pixels to count as an objectLower values = more detections (including fainter objects
and noise)
Higher values = fewer detections (only brightest objects)
magzeroBy default, ProFound reports brightness in raw counts (ADU). To convert to magnitudes:
maskIf certain parts of your image are bad (cosmic rays, detector artifacts), provide a mask:
library(ProFound)
#> Loading required package: Rfits
#> Loading required package: magicaxis
#> Loading required package: Rcpp
#>
#> Attaching package: 'ProFound'
#> The following object is masked _by_ '.GlobalEnv':
#>
#> %nin%
library(Rfits)
# 1. Read your image
image = Rfits_read_image(system.file("extdata", 'VIKING/mystery_VIKING_Z.fits',
package="ProFound"))
# 2. Create a simple mask (remove obvious bad pixels)
mask <- image$imDat < -10 # Ignore very negative pixels
# 3. Run ProFound with sensible settings for detecting galaxies
result <- profoundProFound(
image = image,
mask = mask,
skycut = 1.5, # Moderate sensitivity
pixcut = 3, # Require at least 3 connected pixels
magzero = 26, # Convert to magnitudes
pixscale = 0.3, # Pixel scale in arcsec
plot = TRUE # Show diagnostic plots
)
# 4. Examine the results
cat_objects <- result$segstats
# How many objects did we detect?
nrow(cat_objects)
#> [1] 58
# What's the brightest object? (Usually the first object with segID=1, but not always)
brightest <- cat_objects[which.max(cat_objects$flux), ]
# Plot a histogram of magnitudes
hist(cat_objects$mag, breaks = 50,
main = "Magnitude Distribution",
xlab = "Magnitude")Often the only bit people want to save is the segstats catalogue:
ProFound also returns result$segim, a “segmentation
image”:
# How many unique objects were detected?
length(unique(as.integer(result$segim))) - 1L
#> [1] 58
# Which will be the same as
dim(result$segstats)
#> [1] 58 62
# Visualize it
magimage(result$segim, col = rainbow(max(result$segim)))Increase skycut or pixcut:
Decrease skycut or pixcut:
Lower de-blending tolerance:
?profoundProFound for the full parameter
listprofoundProFound(..., plot = TRUE) to see
diagnostic plotsprofoundProFound output,
i.e. plot(result)Good luck with your analysis!