Skip to content

Commit

Permalink
Updates to help section
Browse files Browse the repository at this point in the history
Fixed bug with confidence display
Bumped version
  • Loading branch information
Mattk70 committed Nov 26, 2023
1 parent 6f5be6e commit 40bf868
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 61 deletions.
10 changes: 5 additions & 5 deletions Help/keyboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<table class="table table-hover p-1">
<tr>
<td colspan="2" class="text-center bg-dark text-white"><h5>File handling</h5></td>
<td colspan="2" class="text-center text-bg-light"><h5>File handling</h5></td>
</tr>
<tr>
<td><b>Ctrl-O</b></td>
Expand All @@ -21,7 +21,7 @@
</tr>

<tr>
<td colspan="2" class="text-center bg-dark text-white"><h5>Analysis</h5></td>
<td colspan="2" class="text-center text-bg-light"><h5>Analysis</h5></td>
</tr>
<tr>
<td><b>Ctrl-A</b></td>
Expand All @@ -38,7 +38,7 @@
<td>Stop analysis</td>
</tr>
<tr>
<td colspan="2" class="text-center bg-dark text-white"><h5>Transport Controls</h5></td>
<td colspan="2" class="text-center text-bg-light"><h5>Transport Controls</h5></td>
</tr>
<tr>
<td><b>SpaceBar</b></td>
Expand Down Expand Up @@ -89,7 +89,7 @@
<td>Skip back to the previous detection</td>
</tr>
<tr>
<td colspan="2" class="text-center bg-dark text-white"><h5>Spectrogram</h5></td>
<td colspan="2" class="text-center text-bg-light"><h5>Spectrogram</h5></td>
</tr>
<tr>
<td><b>Ctrl+ or + </b></td>
Expand Down Expand Up @@ -122,7 +122,7 @@
<td>Toggle Fullscreen mode</td>
</tr>
<tr>
<td colspan="2" class="text-center bg-dark text-white"><h5>Records</h5></td>
<td colspan="2" class="text-center text-bg-light"><h5>Records</h5></td>
</tr>
<tr>
<td><b>Delete</b> or <b>Backspace</b></td>
Expand Down
14 changes: 12 additions & 2 deletions Help/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@
</ul>
</td>
</tr>
<th>Model</th>
<td>Choose the model to use for prediction.
<ul>
<li>
<b>Chirpity</b> will use the native Chirpity model for predictions.
</li>
<li>
<b>BirdNet</b> will use the BirdNet model.
</li>
</ul>
</td>
</tr>
<tr>
<th>Threads</th>
<td>This setting allows you to select the number of threads to use for predictions.
Expand All @@ -142,8 +154,6 @@
<th>Batch Size</th>
<td>This setting determines the number of three-second audio chunks to process each time a prediction is requested.
Larger values lead to faster processing, especially on long files.
However, setting it too high for your machine can cause the Chirpity model to crash due to memory limitations.
If this happens, set a lower value and restart Chirpity.
</td>
</tr>
</table>
Expand Down
56 changes: 29 additions & 27 deletions Help/usage.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ <h5 class="pt-2">Exploring Detections</h5>
</li>
</ol>
<h5 class="pt-2">Summary and Filtering Detections</h5>
<ol start="7">
<ol start="6">
<li>
A summary table appears to the left of the results once the model has completed its analysis. Importantly,
this
Expand All @@ -118,7 +118,7 @@ <h5 class="pt-2">Summary and Filtering Detections</h5>
</li>
</ol>
<h5 class="pt-2">Custom "Deep Dive" Detections</h5>
<ol start="8">
<ol start="7">
<li>Sometimes, a call is missed or a detection is erroneous due to the position of the analysis window in
relation
to the call. The window can be moved by dragging it, or you can create a new window by clicking and
Expand All @@ -132,7 +132,7 @@ <h5 class="pt-2">Custom "Deep Dive" Detections</h5>
</ol>

<h5 class="pt-2">Amending Results</h5>
<ol start="10">
<ol start="8">
<li>It is possible to remove results from what will be saved by selecting <span
class='delete material-symbols-outlined'>delete_forever</span> <b>Delete Record</b> in the context menu.
This can be selected on a per-detection basis in the results table, or a per-species basis in the summary.
Expand All @@ -141,32 +141,10 @@ <h5 class="pt-2">Amending Results</h5>
</ol>

<h5 class="pt-2">Saving Results</h5>
<ol start="10">
<li>There are several ways to save results:
<ol>

<ol start="9">
<li>Once the analysis is complete, and after you have made any amendments, you can save the results to a
database <b>Records > Save to Archive </b>
After this, it will bring in the results from the database records. You can also explore and chart
saved records.

<li>Save the detections as a label file in Audacity format. Press <b>Ctrl-A</b> or select <b>File > Save
Audacity Labels</b> from the menu. By default, the label file will have the same name as the
audio file,
with a ".txt" extension.
database by selecting <b>Records > <span class="material-symbols-outlined">archive</span> Save to Archive </b>
</li>
<li>
Export an audio clip of a detection. To do this, select <span class="material-symbols-outlined">
music_note
</span><b>Export Audio Clip</b> on the context menu. By default, the filename will contain the
species and
timestamp of the detection identifying its position in the original audio file. The <b>Settings</b>
menu allows you
to control the format and quality of the exported files as well as apply padding and a fade effect
to the beginning and end of the audio.
</li>
</ol>
</li>
</ol>

<h5 id="reload" class="pt-2">Restoring Results</h5>
Expand All @@ -181,6 +159,30 @@ <h5 id="reload" class="pt-2">Restoring Results</h5>
cue from this file's creation time, use the original one.</p>
<p>From the records menu, you can also browse saved detections by species, and within a date range of your choosing.
Furthermore, you can generate charts of the species detected over time.</p>

<h5 id="reload" class="pt-2">Exporting Results</h5>
There are a number of ways to export detections.
<ol>
<li>Save the detections as a label file in Audacity format. Press <b>Ctrl-A</b> or select <b>File > Save
Audacity Labels</b> from the menu. By default, the label file will have the same name as the
audio file,with a ".txt" extension.
</li>
<li>
Export an audio clip of a detection. To do this, select <span class="material-symbols-outlined">
music_note
</span><b>Export Audio Clip</b> on the context menu. By default, the filename will contain the
species and
timestamp of the detection identifying its position in the original audio file. The <b>Settings</b>
menu allows you
to control the format and quality of the exported files as well as apply padding and a fade effect
to the beginning and end of the audio.
</li>
<li>
Export a CSV file of detections. To do this, select <span class="material-symbols-outlined">
ios_share
</span><b>Export results to CSV</b> from the file menu. This will export the results to a CSV file in the folder you choose.
</li>
</ol>
</body>

</html>
42 changes: 22 additions & 20 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -3451,43 +3451,42 @@ document.addEventListener("DOMContentLoaded", function () {


// Confidence thresholds
const thresholdDisplay = document.getElementById('threshold-value');
const confidenceDisplay = document.getElementById('confidence-value');
const confidenceSliderDisplay = document.getElementById('confidenceSliderContainer');
const confidenceSlider = document.getElementById('confidenceValue');
const confidenceRange = document.getElementById('confidence');

const filterPanelThresholdDisplay = document.getElementById('threshold-value'); // confidence % display in panel
const settingsPanelThresholdDisplay = document.getElementById('confidence-value'); // confidence % display in settings
const confidenceSliderDisplay = document.getElementById('confidenceSliderContainer'); // confidence span for slider in panel - show-hide
const filterPanelRangeInput = document.getElementById('confidenceValue'); // panel range input
const settingsPanelRangeInput = document.getElementById('confidence'); // confidence range input in settings

const setConfidence = (e) => {

confidenceRange.value = e.target.value;
//settingsPanelRangeInput.value = e.target.value;
handleThresholdChange(e);
}

thresholdDisplay.addEventListener('click', (e) => {
filterPanelThresholdDisplay.addEventListener('click', (e) => {
e.stopPropagation();
confidenceSliderDisplay.classList.toggle('d-none');
// confidenceTimerTimeout = setTimeout(hideConfidenceSlider, 1750)
})
confidenceSlider.addEventListener('click', (e) => {
filterPanelRangeInput.addEventListener('click', (e) => {
e.stopPropagation();
})

const hideConfidenceSlider = () => {
confidenceSliderDisplay.classList.add('d-none');
}
confidenceSliderDisplay.addEventListener('change', setConfidence);


function showThreshold(threshold) {
thresholdDisplay.innerHTML = `<b>${threshold}%</b>`;
confidenceDisplay.innerHTML = `<b>${threshold}%</b>`;
confidenceSlider.value = threshold;
confidenceRange.value = threshold;
function showThreshold(e) {
const threshold = e instanceof Event ? parseInt(e.target.value) : e;
filterPanelThresholdDisplay.innerHTML = `<b>${threshold}%</b>`;
settingsPanelThresholdDisplay.innerHTML = `<b>${threshold}%</b>`;
filterPanelRangeInput.value = threshold;
settingsPanelRangeInput.value = threshold;
}
settingsPanelRangeInput.addEventListener('input', showThreshold);
filterPanelRangeInput.addEventListener('input', showThreshold);

const handleThresholdChange = (e) => {
const threshold = parseInt(e.target.value);
showThreshold(threshold);
config.detect.confidence = threshold;
updatePrefs();
worker.postMessage({
Expand All @@ -3505,10 +3504,13 @@ const handleThresholdChange = (e) => {
action: 'filter',
species: isSpeciesViewFiltered(true),
updateSummary: true
}); // no re-prepare
});
}
}
confidenceRange.addEventListener('input', handleThresholdChange);
filterPanelRangeInput.addEventListener('change', handleThresholdChange);
settingsPanelRangeInput.addEventListener('change', handleThresholdChange);


// Filter handling
const filterIconDisplay = () => {
if (config.filters.active && (config.filters.highPassFrequency || (config.filters.lowShelfAttenuation && config.filters.lowShelfFrequency) || config.filters.SNR)) {
Expand Down
7 changes: 1 addition & 6 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2060,8 +2060,6 @@ async function setStartEnd(file) {
} else {
boundaries = [{ start: 0, end: meta.duration }];
}
// const { start, end } = boundaries[0];
// return [start, end];
return boundaries;
}

Expand All @@ -2083,7 +2081,6 @@ const getSummary = async ({
}

t0 = Date.now();
//const speciesForSTMT = species || '%';
const params = getSummaryParams(species);
const summary = await STATE.GET_SUMMARY_SQL.allAsync(...params);

Expand All @@ -2105,7 +2102,6 @@ const getSummary = async ({
*
* @param files: files to query for detections
* @param species: filter for SQL query
* @param context: can be 'results', 'resultSummary' or 'selectionResults'
* @param limit: the pagination limit per page
* @param offset: is the SQL query offset to use
* @param topRankin: return results >= to this rank for each datetime
Expand All @@ -2115,7 +2111,6 @@ const getSummary = async ({
*/
const getResults = async ({
species = undefined,
context = 'results',
limit = STATE.limit,
offset = undefined,
topRankin = STATE.topRankin,
Expand Down Expand Up @@ -2168,7 +2163,7 @@ const getResults = async ({
i === result.length - 1 && UI.postMessage({ event: 'generate-alert', message: `${result.length} files saved` })
}
}
else if (species && context !== 'explore') {
else if (species && STATE.mode !== 'explore') {
// get a number for the circle
const { count } = await STATE.db.getAsync(`SELECT COUNT(*) as count FROM records WHERE dateTime = ?
AND confidence >= ?`, r.timestamp, confidence);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chirpity",
"version": "0.10.1",
"version": "0.10.2",
"description": "Chirpity Nocmig",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit 40bf868

Please sign in to comment.