Skip to content

Commit

Permalink
Merge branch 'develop' into feature/CS-494-spectrogram-from-api
Browse files Browse the repository at this point in the history
  • Loading branch information
rassokhin-s authored Feb 17, 2021
2 parents c94388c + 8120799 commit 3529447
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 38 deletions.
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Arbimon Release Notes

## v3.0.10
## v3.0.10 - Feb XX, 2021

New features:
- ([CS-494](https://jira.rfcx.org/browse/CS-494)) Request spectrogram tiles from Media API for audios from RFCx streams
- CS-494 Request spectrogram tiles from Media API for audios from RFCx streams

## v3.0.9 - Feb 12, 2021
Resolved issues:
- PI-545 Improve the quality of the spectrogram image
- PI-504 Can not filter more than one tag
- CS-474 Drop unique constraint on `projects` `name` column

## v3.0.9 - Feb 15, 2021

New features:
- PI-263 Admin can enable Audio-event-detection and Clustering pages
Expand Down
4 changes: 3 additions & 1 deletion app/model/recordings.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@ var Recordings = {
audioTools.spectrogram(recording_path.path, cache_miss.file, {
pixPerSec : config("spectrograms").spectrograms.pixPerSec,
height : config("spectrograms").spectrograms.height,
...recording.uri.endsWith('.opus') && recording.sample_rate && { maxfreq: recording.sample_rate * 2 }
...recording.uri.endsWith('.opus') && recording.sample_rate && { maxfreq: recording.sample_rate * 2 },
...recording.contrast && { contrast: recording.contrast }
},function(status_code){
if(status_code) { callback({code:status_code}); return; }
cache_miss.retry_get();
Expand All @@ -590,6 +591,7 @@ var Recordings = {
},
function(rec_info, next){
recording = rec_info;
recording.contrast = 105;
Recordings.fetchSpectrogramFile(recording, next);
},
function(specFile, next){
Expand Down
5 changes: 4 additions & 1 deletion app/utils/audiotool.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ var audiotools = {
* of the audio file's duration. (default: 172)
* @param {Integer} options.quantization number of colors gradations used in the spectrogram image.
* (default: 249, the maximum)
* @param {Integer} options.contrast the ‘contrast’ of the spectrogram display.
* @param {String} options.window windowing function used to compute the spectrogram.
* (One of 'Hann', 'Hamming', 'Bartlett', 'Rectangular', 'Kaiser', default: 'Hann')
* @param {Function} callback callback function.
Expand Down Expand Up @@ -192,7 +193,9 @@ var audiotools = {
args.push(
'-q', ((options.quantization | 0) || 249) // color quantization
);

if(options.contrast) {
args.push('-z', options.contrast);
}
if(options.window && ['Hann', 'Hamming', 'Bartlett', 'Rectangular', 'Kaiser'].indexOf(options.window) >= 0) {
args.push('-w', options.window); // just the raw spectrogram image
}
Expand Down
12 changes: 6 additions & 6 deletions assets/app/app/analysis/patternmatching/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,14 @@ angular.module('a2.analysis.patternmatching', [
{ class:'fa fa-th', value:'is-small'},
],
search: [
{value:'all', text:'All', description: 'Show all matched rois.'},
{value:'present', text:'Present', description: 'Show all rois marked as present.'},
{value:'not_present', text:'Not Present', description: 'Show all rois marked as not present.'},
{value:'unvalidated', text:'Unvalidated', description: 'Show all rois without validation.'},
{value:'all', text:'All', description: 'Show all matched Region of Interest.'},
{value:'present', text:'Present', description: 'Show all Region of Interest marked as present.'},
{value:'not_present', text:'Not Present', description: 'Show all Region of Interest marked as not present.'},
{value:'unvalidated', text:'Unvalidated', description: 'Show all Region of Interest without validation.'},
{value:'best_per_site', text:'Best per Site', description: 'Show the best scored roi per site.'},
{value:'best_per_site_day', text:'Best per Site, Day', description: 'Show the best scored roi per site and day.'},
{value:'by_score', text:'Score', description: 'Show all rois ranked by score.'},
{value:'by_score_per_site', text:'Score per Site', description: 'Show all rois ranked by score per site.'},
{value:'by_score', text:'Score', description: 'Show all Region of Interest ranked by score.'},
{value:'by_score_per_site', text:'Score per Site', description: 'Show all Region of Interest ranked by score per site.'},
],
selection: [
{value:'all', text:'All'},
Expand Down
49 changes: 24 additions & 25 deletions assets/app/app/audiodata/recordings/filter-parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ angular.module('a2.audiodata.recordings.filter-parameters', [
requires:'^RecsCtrl',
link: function(scope, element, attrs) {
var controller = scope.controller;

scope.applyFilters = function() {
scope.onApplyFilters({filters: controller.getFilters()});
};
Expand Down Expand Up @@ -55,12 +55,12 @@ angular.module('a2.audiodata.recordings.filter-parameters', [
return _1.length !== undefined && _1.map(mapFn);
};
}

var _1_get_value_mapper = _1_mapper(_1_get("value"));
var _1_get_id_mapper = _1_mapper(_1_get("id"));
var _1_get_tag_id_mapper = _1_mapper(_1_get("tag_id"));
var _1_get_flags_mapper = _1_mapper(_1_get("flags"));

var findObjectWith = function(arr, key, value) {
var result = arr.filter(function(obj) {
return obj[key] === value;
Expand Down Expand Up @@ -96,7 +96,7 @@ angular.module('a2.audiodata.recordings.filter-parameters', [
soundscape_composition_annotation : ['present', 'absent'],
};
this.params={};

var filterDefs = [
{name:"range" , map: function set_range_bounds(range){
if(range && range.from && range.to) {
Expand All @@ -123,23 +123,23 @@ angular.module('a2.audiodata.recordings.filter-parameters', [
this.getFilters = function() {
var filters = {};
var params = this.params;

filterDefs.forEach(function(filterDef){
var param = params[filterDef.name];
var value = (param && filterDef.map) ? filterDef.map(param) : param;
if(value instanceof Array ? value.length : value){
filters[filterDef.name] = value;
}
});

return filters;
};

this.fetchOptions = function(filters) {
if(filters === undefined){
filters = {};
}

var options = this.options;
Project.getSites().then(function(sites){
return $q.all(sites.map(function(site){
Expand All @@ -157,13 +157,13 @@ angular.module('a2.audiodata.recordings.filter-parameters', [
days: [], // daysList
hours: [], // hoursList
};

var levelIds = Object.keys(lists);

var getFilterOptions = function(filters, obj, level) {
var count = 0;
var currentLevel = levelIds[level];

for(var child in obj) {
if(
Object.keys(filters).length &&
Expand All @@ -172,35 +172,35 @@ angular.module('a2.audiodata.recordings.filter-parameters', [
) { // skip if filter is define and the value is not in it
continue;
}

var item = findObjectWith(lists[currentLevel], 'value', child);

if(!item) {
item = { value: child, count: 0 };
lists[currentLevel].push(item);
}

var itemCount;
if(typeof obj[child] == 'number') {
itemCount = obj[child];
}
else {
if(level === 0) count = 0;

itemCount = getFilterOptions(filters, obj[child], level+1);
}

item.count += itemCount;
count += itemCount;
}

return count;
};
getFilterOptions(filters, data, 0);

options.sites = lists.sites;
options.years = lists.years;

options.months = lists.months.map(function(month) {
month.value = parseInt(month.value);
month.value--;
Expand All @@ -210,12 +210,12 @@ angular.module('a2.audiodata.recordings.filter-parameters', [
count: month.count
};
});

options.days = lists.days.map(function(day) {
day.value = parseInt(day.value);
return day;
});

options.hours = lists.hours.map(function(hour) {
hour.value = parseInt(hour.value);
return {
Expand All @@ -224,11 +224,11 @@ angular.module('a2.audiodata.recordings.filter-parameters', [
count: hour.count
};
});

var sort = function(a, b) {
return a.value > b.value;
};

options.sites.sort(sort);
options.years.sort(sort);
options.months.sort(sort);
Expand All @@ -254,12 +254,11 @@ angular.module('a2.audiodata.recordings.filter-parameters', [
if (!tagsObj[key]) {
tagsObj[key] = {
tag: key,
tag_id: [t.tag_id],
tag_id: t.tag_id,
count: t.count
}
}
else {
tagsObj[key].tag_id.push(t.tag_id);
tagsObj[key].count++
}
})
Expand All @@ -277,7 +276,7 @@ angular.module('a2.audiodata.recordings.filter-parameters', [
options.soundscape_composition = classes;
}).bind(this));
};

this.computeClassificationResultsOptions = function(classifications){
console.log("this.computeClassificationResults = function(classifications){", classifications);
var haveThreshold = classifications && classifications.reduce(function(a, b){
Expand Down
2 changes: 1 addition & 1 deletion assets/app/orders/change-plan.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h4>
Your current plan has ended, please select a new plan.
The minumum plan is limited by the project storage usage.
</p>
<p ng-if="autoPaymentsEnabled === false" class="text-danger">
<p ng-if="autoPaymentsEnabled === false" style="font-size: small">
Please contact us at <a ng-href="mailto:support@rfcx.org">support@rfcx.org</a> if you have any questions or concerns.
</p>
</div>
Expand Down
1 change: 0 additions & 1 deletion scripts/db/000-base-tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,6 @@ CREATE TABLE `projects` (
`citizen_scientist_enabled` tinyint(1) NOT NULL DEFAULT '0',
`cnn_enabled` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`project_id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `url` (`url`),
KEY `project_type_id` (`project_type_id`),
KEY `current_plan` (`current_plan`),
Expand Down

0 comments on commit 3529447

Please sign in to comment.