QutEcoacoustics / audio-analysis

The audio analysis code (AnalysisPrograms.exe) for the QUT Ecoacoustics Research Group
https://ap.qut.ecoacoustics.info/
Apache License 2.0
52 stars 12 forks source link

The Output field is required. #530

Closed Zakher21 closed 2 years ago

Zakher21 commented 2 years ago

Describe the bug

I'm analysing .flac files on mac (with Rstudio) and getting this error:

The Output field is required. There were 50 or more warnings (use warnings() to see the first 50)

Expected behavior

I'm using Towsey.acoustics.yml script to calculate acoustic indices.

Diagnostics

Instructions

✅ I have followed the instructions for reporting a bug

The operating system I'm using is:

### The version of **AnalysisPrograms.exe** I'm using is:

Additional Details

Screen Shot 2022-02-14 at 4 18 45 PM

atruskie commented 2 years ago

Hi @Zakher21,

I'm going to need more information to properly diagnose this. Can you send the script you're using to run AP? How about one of AP's logs (details on how to get a log are in the link from your original post).

I reckon I might be able to guess though:

The The Output field is required message probably came from AP. AP needs three arguments for most commands: Input, Config, and Output (https://ap.qut.ecoacoustics.info/technical/commands/analyze_long_recording.html). I'd say you didn't provide an output argument.

The warning message is likely from R. When you run another program with system2 it will render a warning if that program fails to run. From the R docs: https://stat.ethz.ch/R-manual/R-devel/library/base/html/system2.html#:~:text=If%20the%20command%20could%20not%20be%20run%20for,is%20issued%20and%20the%20exit%20status%20is%20124.

If command runs but gives a non-zero exit status this will be reported with a warning and in the attribute "status" of the result: an attribute "errmsg" may also be available.

I can confirm this with your script and or logs. But you can probably just fix it as well 😄

Zakher21 commented 2 years ago

Hi,

Thank you for your answer. I don't think it's related to providing an output argument. I Have the same script that is working on a mac pro (big sur) but not working on the one I mentioned previously. here is my code

`This script calculates acoustic indices for the specified files - Mac Version

Set the directory containing the files directory <- "directory path"

The directory to store the results base_output_directory <-"Output path"

Get a list of audio files inside the directory

files <- list.files(directory, pattern = "*.flac",recursive = TRUE, full.names = TRUE)

iterate through each file for(file in files) { message("Processing ", file)

get just the name of the file file_name <- basename(file)

make a folder for results output_directory <- normalizePath(file.path(base_output_directory, file_name))

prepare command command <- sprintf('audio2csv "%s" "/Users/user/AP_osx-x64_v21.7.0.4/ConfigFiles/Towsey.Acoustic.yml" "%s" ', file, output_directory)

finally, execute the command system2('/Users/user/AP_osx-x64_v21.7.0.4/AnalysisPrograms', command) }`

atruskie commented 2 years ago

Fair enough; how about a log from AP? The one of the first lines in the log file prints out the command given to AP - we can use that to work out what AP thinks is happening.

What are the other warnings from the warnings() command?

If you construct the command manually and run it in Terminal (rather than in R) does it work? or fail? (if you print the command variable you can see the constructed command and the copy & paste that into Terminal).

Basically, the answer is non-obvious and we'll need systematically rule out things.

atruskie commented 2 years ago

You should find logs in /Users/user/AP_osx-x64_v21.7.0.4/Logs

Zakher21 commented 2 years ago

2022-02-18T10:51:42.5310030-06:00 [1] INFO CleanLogger - QUT Ecoacoustics Analysis Programs - version 21.7.0.4 (RELEASE build, 2021-07-05T04:43:19.0973090+00:00) Git branch-version: master-e26127a50d7bd7472d47288f10e61014fb981f7f, DirtyBuild:False, CI:55 Copyright 2022 QUT 2022-02-18T10:51:42.5393030-06:00 [1] INFO LogFileOnly - Executable called with these arguments: /Users/zakherbouragaoui/AP_osx-x64_v21.7.0.4/AnalysisPrograms.dll audio2csv /Users/zakherbouragaoui/Documents/Data/Audio/G001_V1_C0345_U1/T001_V1_C345_U1_20210605/T001_V1_C345_U1_20210605_040102Z.flac //Users/zakherbouragaoui/AP_osx-x64_v21.7.0.4/ConfigFiles/Towsey.Acoustic.yml

2022-02-18T10:51:42.6544220-06:00 [1] ERROR LogFileOnly - The Output field is required. 2022-02-18T10:51:42.6546890-06:00 [1] INFO LogFileOnly - Specify --help for a list of available options and commands. 2022-02-18T10:51:42.7659550-06:00 [1] INFO LogFileOnly - Programs stats: { "Platform": "Unix 11.0.0", "ProcessorCount": 4, "ExecutionTime": 0.368427, "PeakWorkingSet": 0 } 2022-02-18T10:51:42.7660290-06:00 [1] INFO LogFileOnly - ERRORLEVEL: 1

atruskie commented 2 years ago

(You can attach a log file, just drag from your file explorer into the message body).

OK, so that confirms it, AP is not receiving an output argument. The relevant log line:

2022-02-18T10:51:42.5393030-06:00 [1] INFO LogFileOnly - Executable called with these arguments:
/Users/zakherbouragaoui/AP_osx-x64_v21.7.0.4/AnalysisPrograms.dll audio2csv /Users/zakherbouragaoui/Documents/Data/Audio/G001_V1_C0345_U1/T001_V1_C345_U1_20210605/T001_V1_C345_U1_20210605_040102Z.flac //Users/zakherbouragaoui/AP_osx-x64_v21.7.0.4/ConfigFiles/Towsey.Acoustic.yml

You can see:

Note though, it is weird that there is a double slash // at the start of the config argument.


Now we have to work out why this is happening.

My previous response asked for more diagnostic detail:

(if you print the command variable you can see the constructed command and the copy & paste that into Terminal).

So we need to understand what the value of command is in your R script. Print the output and get back to me?

Zakher21 commented 2 years ago

Hi @atruskie

Thank you very much. Indeed that was the issue. the double slash // at the start of the config argument. I changed that and it's now working. Thank you again for your support and help.