## file:getSamplingFrequencies.KAIRA.R
## (c) 2010- University of Oulu, Finland
## Written by Ilkka Virtanen <ilkka.i.virtanen@oulu.fi>
## Licensed under FreeBSD license.
##
##
## Read sampling frequencies from sampler log files.
##
## Arguments:
## LPIparam A LPI parameter list
##
## Returns:
## sampFreqs A named list of sample rates with
## elements "RX1", "RX2", "TX1", "TX2"
##
getSamplingFrequencies.KAIRA <- function( LPIparam )
{
# A vector for the sample rates
sampFreqs <- rep(NA,4)
names( sampFreqs ) <- c( "RX1" , "RX2" , "TX1" , "TX2" )
# Try to read the sampling frequencies from sampler
# log files, but do not overwrite possible
# user-input if the read fails
for( XXN in c( "TX1" , "TX2" ) ){
# First try from the data directory
tmpfreq <- LPI.gdf:::readSamplingFrequency.gdf( LPIparam[["dataDir"]][XXN] , samplerLog="sampler.log")
# If the first read fails try one step up in hierarcy
if( is.null( tmpfreq ) ) tmpfreq <- LPI.gdf:::readSamplingFrequency.gdf( LPIparam[["dataDir"]][XXN] , samplerLog=file.path("..","sampler.log") )
# If the read succeeded copy the value
# otherwise print a warning message.
if( !is.null( tmpfreq ) ){
sampFreqs[XXN] <- tmpfreq
}else{
cat("Could not read sampler log file from" , LPIparam[["dataDir"]][XXN] , "\n")
}
}
# Check if LOFARclock was set manually, default 200e6
if( is.null( LPIparam[["LOFARclock"]]) ) LPIparam[["LOFARclock"]] <- 200e6
sampFreqs["RX1"] <- LPIparam[["LOFARclock"]]/1024
sampFreqs["RX2"] <- LPIparam[["LOFARclock"]]/1024
return( sampFreqs )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.