Skip to content

Commit

Permalink
bug seltailor when resuming
Browse files Browse the repository at this point in the history
  • Loading branch information
maRce10 committed Jul 17, 2018
1 parent cf7047e commit 2c8730a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 47 deletions.
78 changes: 40 additions & 38 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

===============================================================================================

## warbleR 1.1.15
### (CRAN release date: )
### *warbleR 1.1.15*
#### *(CRAN release date: )*

</br>

#### New functions:

* 'multi_DTW': wrapper on dtw for comparing signals described by multiple contours
* multi_DTW: wrapper on dtw for comparing signals described by multiple contours

#### Changes and additions:

* 'selection_table` now can take files found in different directories and create extended selection tables

===============================================================================================

## warbleR 1.1.14
### (CRAN release date: 2018-06-22)
### *warbleR 1.1.14*
#### *(CRAN release date: 2018-06-22)*

</br>

Expand All @@ -28,8 +28,8 @@

===============================================================================================

## warbleR 1.1.13
### (CRAN release date: 2018-05-18)
### *warbleR 1.1.13*
#### *(CRAN release date: 2018-05-18)*

</br>

Expand All @@ -42,11 +42,11 @@
* 'ts.df' argument in 'seltailor' function to adjust frequency contours
* 'by.song' argument in 'specreator' to create full song spectrograms with labeled elements

## Bug fixes:
#### Bug fixes:

* Change "http" to "https" protocol for accessing Xeno-Canto recordings in "querxc"

## New functions:
#### New functions:

* selection_table: converts data frames into an object of classes 'selection_table' or 'extended_selection_table'
* generic S3 methods for and 'print', 'cbind' and '[' for classes 'selection_table' or 'extended_selection_table'
Expand All @@ -58,8 +58,8 @@

===============================================================================================

## warbleR 1.1.12
### (CRAN release date: 2018-03-13)
### *warbleR 1.1.12*
#### *(CRAN release date: 2018-03-13)*

</br>

Expand All @@ -73,36 +73,36 @@
* New arguments in 'specreator' to customize control lines/box around selections
* Replace internal "message" functions by "cat" (so warnings are printed in black, no red)

## New functions:
#### New functions:

* track_harm: track harmonic frequency contour
* sim_song: simulate songs


===============================================================================================

## warbleR 1.1.10
### (CRAN release date: 2018-08-28)
### *warbleR 1.1.10*
#### *(CRAN release date: 2018-08-28)/

</br>

#### Changes and additions:

* Example sound files have been moved to the new R package 'NatureSounds' (which is now a dependency)

## Bug fixes:
#### Bug fixes:

* Problem with multiple tags in 'catalog'

## New functions:
#### New functions:

* rm_sil: removes silence segments (i.e. segments with very low amplitude values) from wave files
* consolidate: copies (sound) files scattered in several directories into a single folder

===============================================================================================

## warbleR 1.1.9
### (CRAN release date: 2017-11-18)
### *warbleR 1.1.9*
#### *(CRAN release date: 2017-11-18)*

</br>

Expand All @@ -121,7 +121,7 @@
* "imp.raven" and "imp.syrinx" now import low and high frequency in kHz (if all.data == FALSE)
* Mew argument "bp" (bandpass) and "wl" in "sig2noise" function to calculate signal-to-noise ratio within a frequency range

## New functions:
#### New functions:

* is.selection.table: checks if an object is of class 'selection.table'
* make.selection.table: creates an object of class 'selection.table'
Expand All @@ -133,40 +133,42 @@
* color_spectro: produces spectrograms in which signals are highlighted with colors
* exp.raven: exports selection tables to a .txt file that can be opened in Raven

## Bug fixes:
#### Bug fixes:

* Reading wave files with no stereo slot in "specan" and "checksels"

===============================================================================================

## warbleR 1.1.8
### (CRAN release date: 2017-04-26)
### *warbleR 1.1.8*
#### *(CRAN release date: 2017-04-26)*

## Bug fixes:
#### Bug fixes:

* installation in some linux distributions

===============================================================================================

## warbleR 1.1.7
### (CRAN release date: 2017-04-24)
### *warbleR 1.1.7*
#### *(CRAN release date: 2017-04-24)*

</br>

#### Changes and additions:

* "seltailor" function now can use external graphic devices (X11 or quartz)

## Bug fixes:
#### Bug fixes:

* installation in windows OS fixed (pbmcapply conflict in previous version)

===============================================================================================

## warbleR 1.1.6
### (CRAN release date: 2017-04-05)
### *warbleR 1.1.6*
#### *(CRAN release date: 2017-04-05)*

</br>

## New functions:
#### New functions:

* catalog: create song catalogs (i.e. images with multiple spectrograms in several rows/columns that can be color-labeled)
* catalog2pdf: convert several catalog jpeg's images into single pdf files
Expand Down Expand Up @@ -203,16 +205,16 @@ different individuals) would be subset to A-B-A-B-A-B
* 3 different options (formulas) for calculating signal-to-noise ratio are now available (sig2noise function). In addition the "eq.dur" argument allows to measure a noise segment of the same duration than the signal
* grid can be removed from spectrograms in compare.methods function

## Bug fixes:
#### Bug fixes:

* error produced when calculating frequency limits based on dominant frequency contours in xcorr (when frange is not provided)
* error for identifying readable sound files in some specific .wav formats in checkwavs function
* error when comparing signals with a high duration difference in xcorr

===============================================================================================

## warbleR 1.1.5
### (CRAN release date: 2017-01-19)
### *warbleR 1.1.5*
#### *(CRAN release date: 2017-01-19)*

</br>

Expand All @@ -226,15 +228,15 @@ different individuals) would be subset to A-B-A-B-A-B
* added 'clip.edges' argument to dfts/ ffts/ dfDTW/ ffDTW/sp.en.ts functions to remove missing values at the start or end of signals
* more detailed checksels output (now including, sampling rate, duration, number of samples and bits)

## New functions:
#### New functions:

* sp.en.ts: extracts the spectral entropy across signals as a time series iteratively


===============================================================================================

## warbleR 1.1.4
### (CRAN release date: 2016-11-14)
### *warbleR 1.1.4*
#### *(CRAN release date: 2016-11-14)*

</br>

Expand All @@ -245,14 +247,14 @@ different individuals) would be subset to A-B-A-B-A-B
* new "sp" argument in compare.methods to allow users to input their own spectral parameters
* new "custom.contour" argument in trackfreqs to allow users to input their own frequency contours

## Bug fixes:
#### Bug fixes:

* bug fix for setting 'path' argument in several functions
* bug fix to due to missing values (undetected) in amplitude detection in trackfreqs, ffts, dfts, ffDTW, and dfDTW

## New functions:
#### New functions:

* filtersels: subsets selection data frames based on manually filtered image files
* lspec2pdf: combines lspec images to single pdf files iteratively


</br>
13 changes: 5 additions & 8 deletions R/checksels.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ checksels <- function(X = NULL, parallel = 1, path = NULL, check.header = FALSE
#if there are NAs in start or end stop
if (any(is.na(c(X$end, X$start)))) stop("NAs found in start and/or end")

if (any(duplicated(paste(X$sound.files, X$selec)))) stop("Duplicated selection labels for one or more sound files")
if (any(duplicated(X[, c("sound.files", "selec")]))) stop("Duplicated selection labels for one or more sound files")

#if any start higher than end stop
if (any(X$end - X$start < 0)) stop(paste("The start is higher than the end in", length(which(X$end - X$start < 0)), "case(s)"))
Expand All @@ -116,15 +116,10 @@ checksels <- function(X = NULL, parallel = 1, path = NULL, check.header = FALSE
}}

#check if files are in working directory
files <- file.exists(as.character(X$sound.files))
files <- file.exists(as.character(unique(X$sound.files)))
if (all(!files))
stop("no .wav files found")


#if any selection labels are repeated within a sound file
if (length(unique(paste(X$sound.files, X$selec))) != nrow(X))
stop("Repeated selection labels within (a) sound file(s)")

# update to new frequency range column names
if (any(grepl("low.freq|high.freq", names(X)))) {
names(X)[names(X) == "low.freq"] <- "bottom.freq"
Expand All @@ -134,8 +129,9 @@ checksels <- function(X = NULL, parallel = 1, path = NULL, check.header = FALSE
#check frequency range columns
if ("top.freq" %in% colnames(X))
{
frq.rng <- X$top.freq - X$bottom.freq
#if any start higher than end stop
if (any(X$top.freq - X$bottom.freq < 0)) stop(paste("The bottom frequency is higher than the top frequency in", length(which(X$top.freq - X$bottom.freq < 0)), "case(s)"))
if (any(frq.rng < 0)) stop(paste("The bottom frequency is higher than the top frequency in", length(which(frq.rng < 0)), "case(s)"))
if (any(X$bottom.freq < 0)) stop("bottom frequency lower than 0 for some selections")
}

Expand Down Expand Up @@ -205,6 +201,7 @@ checksels <- function(X = NULL, parallel = 1, path = NULL, check.header = FALSE
Y$sample.rate <- NA
Y$channels <- NA
Y$bits <- NA
Y$sound.file.samples <- NA
} } else {
Y$check.res <- "sound file not found"
Y$duration <- NA
Expand Down
6 changes: 5 additions & 1 deletion R/seltailor.R
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,13 @@ seltailor <- function(X = NULL, wl = 512, flim = c(0,22), wn = "hanning", mar =
cat("all selections have been analyzed")
stop()
}
ncl <- intersect(names(ts.df2), names(X))

if(!is.null(ts.df))
{
ncl <- intersect(names(ts.df2), names(X))
ncl <- ncl[!ncl %in% c("sound.files", "selec")]
}
}

dn <- 1:nrow(X)
if (any(!is.na(X$tailored))) if (length(which(X$tailored == "y")) > 0)
Expand Down

0 comments on commit 2c8730a

Please sign in to comment.