Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HighBlueParsers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Best
HighBlueParsers
Commits
625bbdfc
Commit
625bbdfc
authored
3 years ago
by
Paul Best
Browse files
Options
Downloads
Patches
Plain Diff
better Rapport2info and log2wav
parent
be0660e8
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
RapportInfo2txt
+0
-0
0 additions, 0 deletions
RapportInfo2txt
RapportInfo2txt.c
+12
-10
12 additions, 10 deletions
RapportInfo2txt.c
log2wav
+0
-0
0 additions, 0 deletions
log2wav
log2wav.c
+18
-12
18 additions, 12 deletions
log2wav.c
with
30 additions
and
22 deletions
RapportInfo2txt
+
0
−
0
View file @
625bbdfc
No preview for this file type
This diff is collapsed.
Click to expand it.
RapportInfo2txt.c
+
12
−
10
View file @
625bbdfc
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#define NTOAS_MAX 200
#define NTOAS_MAX 200
#define RORQUAL_SAMPLE_RATE 4000
#define RORQUAL_SAMPLE_RATE 4000
#define RORQUAL_LENSIG RORQUAL_SAMPLE_RATE*
1
0 // load 60sec
#define RORQUAL_LENSIG RORQUAL_SAMPLE_RATE*
6
0 // load 60sec
#define RORQUAL_WINSIZE 4096
#define RORQUAL_WINSIZE 4096
#define RORQUAL_LENSPEC (RORQUAL_LENSIG - RORQUAL_WINSIZE)/RORQUAL_HOPSIZE
#define RORQUAL_LENSPEC (RORQUAL_LENSIG - RORQUAL_WINSIZE)/RORQUAL_HOPSIZE
#define RORQUAL_HOPSIZE 256
#define RORQUAL_HOPSIZE 256
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#define RORQUAL_SAMPLESPERSAMPLE 8000 // see cacha
#define RORQUAL_SAMPLESPERSAMPLE 8000 // see cacha
#define CACHA_SAMPLE_RATE 64000
#define CACHA_SAMPLE_RATE 64000
#define CACHA_LENSIG CACHA_SAMPLE_RATE*10 // load
5
sec
#define CACHA_LENSIG CACHA_SAMPLE_RATE*10 // load
10
sec
#define CACHA_WINSIZE 512
#define CACHA_WINSIZE 512
#define CACHA_LENSPEC (CACHA_LENSIG - CACHA_WINSIZE)/CACHA_HOPSIZE
#define CACHA_LENSPEC (CACHA_LENSIG - CACHA_WINSIZE)/CACHA_HOPSIZE
#define CACHA_HOPSIZE 256
#define CACHA_HOPSIZE 256
...
@@ -27,9 +27,9 @@
...
@@ -27,9 +27,9 @@
typedef
struct
{
typedef
struct
{
float
predsC
[
CACHA_LENPRED
];
//len of preds for 10sec signal
float
predsC
[
CACHA_LENPRED
];
//len of preds for 10sec signal
bool
d
etectionCachalot
;
short
numD
etection
s
Cachalot
;
float
predsR
[
RORQUAL_LENPRED
];
//len of preds for 60sec signal
float
predsR
[
RORQUAL_LENPRED
];
//len of preds for 60sec signal
bool
d
etectionRorqual
;
short
numD
etection
s
Rorqual
;
char
fileName
[
50
];
//Nom du fichier concerne
char
fileName
[
50
];
//Nom du fichier concerne
int
ToAs_cacha
[
NTOAS_MAX
];
int
ToAs_cacha
[
NTOAS_MAX
];
unsigned
char
hydros_ToAs_cacha
[
NTOAS_MAX
];
unsigned
char
hydros_ToAs_cacha
[
NTOAS_MAX
];
...
@@ -40,12 +40,14 @@ typedef struct{
...
@@ -40,12 +40,14 @@ typedef struct{
}
RAPPORT
;
}
RAPPORT
;
int
main
(
int
argc
,
char
*
argv
[]){
int
main
(
int
argc
,
char
*
argv
[]){
FILE
*
infile
=
fopen
(
"Rapport.info"
,
"rb
"
);
printf
(
"Have you checked rorqual and cacha lensigs and config ?? (needs to match with pic32
\'
s)
"
);
FILE
*
out
file
=
fopen
(
"Rapport.txt"
,
"
w+
"
);
FILE
*
in
file
=
fopen
(
argv
[
1
]
,
"
rb
"
);
if
(
infile
==
NULL
){
if
(
infile
==
NULL
){
printf
(
"Failed to open input file
\n
"
);
printf
(
"Failed to open input file
\n
"
);
return
0
;
return
0
;
}
}
strcpy
(
argv
[
1
]
+
strlen
(
argv
[
1
])
-
3
,
"txt
\0
"
);
FILE
*
outfile
=
fopen
(
argv
[
1
],
"w+"
);
if
(
outfile
==
NULL
){
if
(
outfile
==
NULL
){
printf
(
"Failed to open output file
\n
"
);
printf
(
"Failed to open output file
\n
"
);
return
0
;
return
0
;
...
@@ -59,11 +61,11 @@ int main(int argc, char* argv[]){
...
@@ -59,11 +61,11 @@ int main(int argc, char* argv[]){
fprintf
(
outfile
,
"%f,"
,
rapport
.
predsR
[
i
]);
fprintf
(
outfile
,
"%f,"
,
rapport
.
predsR
[
i
]);
}
}
fprintf
(
outfile
,
"
\n
rorqual predPeaks
\n
"
);
fprintf
(
outfile
,
"
\n
rorqual predPeaks
\n
"
);
for
(
i
=
0
;
i
<
RORQUAL_NSAMPLESTOSEND
;
i
++
){
for
(
i
=
0
;
i
<
rapport
.
numDetectionsRorqual
;
i
++
){
fprintf
(
outfile
,
"%hd,"
,
rapport
.
predPeaksR
[
i
]);
fprintf
(
outfile
,
"%hd,"
,
rapport
.
predPeaksR
[
i
]);
}
}
fprintf
(
outfile
,
"
\n
rorqual samples
\n
"
);
fprintf
(
outfile
,
"
\n
rorqual samples
\n
"
);
for
(
i
=
0
;
i
<
RORQUAL_NSAMPLESTOSEND
;
i
++
){
for
(
i
=
0
;
i
<
rapport
.
numDetectionsRorqual
;
i
++
){
for
(
j
=
0
;
j
<
RORQUAL_SAMPLESPERSAMPLE
;
j
++
){
for
(
j
=
0
;
j
<
RORQUAL_SAMPLESPERSAMPLE
;
j
++
){
fprintf
(
outfile
,
"%hd,"
,
rapport
.
samplesR
[
i
][
j
]);
fprintf
(
outfile
,
"%hd,"
,
rapport
.
samplesR
[
i
][
j
]);
}
}
...
@@ -74,11 +76,11 @@ int main(int argc, char* argv[]){
...
@@ -74,11 +76,11 @@ int main(int argc, char* argv[]){
fprintf
(
outfile
,
"%f,"
,
rapport
.
predsC
[
i
]);
fprintf
(
outfile
,
"%f,"
,
rapport
.
predsC
[
i
]);
}
}
fprintf
(
outfile
,
"
\n
cacha predPeaks
\n
"
);
fprintf
(
outfile
,
"
\n
cacha predPeaks
\n
"
);
for
(
i
=
0
;
i
<
CACHA_NSAMPLESTOSEND
;
i
++
){
for
(
i
=
0
;
i
<
rapport
.
numDetectionsCachalot
;
i
++
){
fprintf
(
outfile
,
"%hd,"
,
rapport
.
predPeaksC
[
i
]);
fprintf
(
outfile
,
"%hd,"
,
rapport
.
predPeaksC
[
i
]);
}
}
fprintf
(
outfile
,
"
\n
cacha samples
\n
"
);
fprintf
(
outfile
,
"
\n
cacha samples
\n
"
);
for
(
i
=
0
;
i
<
CACHA_NSAMPLESTOSEND
;
i
++
){
for
(
i
=
0
;
i
<
rapport
.
numDetectionsCachalot
;
i
++
){
for
(
j
=
0
;
j
<
CACHA_SAMPLESPERSAMPLE
;
j
++
){
for
(
j
=
0
;
j
<
CACHA_SAMPLESPERSAMPLE
;
j
++
){
fprintf
(
outfile
,
"%hd,"
,
rapport
.
samplesC
[
i
][
j
]);
fprintf
(
outfile
,
"%hd,"
,
rapport
.
samplesC
[
i
][
j
]);
}
}
...
...
This diff is collapsed.
Click to expand it.
log2wav
+
0
−
0
View file @
625bbdfc
No preview for this file type
This diff is collapsed.
Click to expand it.
log2wav.c
+
18
−
12
View file @
625bbdfc
...
@@ -192,18 +192,20 @@ int main(int argc, char* argv[]){
...
@@ -192,18 +192,20 @@ int main(int argc, char* argv[]){
whdr
.
subChunk2Size
=
whdr
.
chunkSize
-
36
;
whdr
.
subChunk2Size
=
whdr
.
chunkSize
-
36
;
fwrite
(
&
whdr
,
sizeof
(
WaveHeader
),
1
,
wavfile
);
fwrite
(
&
whdr
,
sizeof
(
WaveHeader
),
1
,
wavfile
);
FILE
*
mpuFile
;
// open mpu file
FILE
*
mpuFile
=
NULL
;
// open mpu file
if
(
argc
>
3
){
if
(
argc
>
3
){
mpuFile
=
fopen
(
argv
[
3
],
"w+"
);
mpuFile
=
fopen
(
argv
[
3
],
"w+"
);
}
else
{
strcpy
(
argv
[
1
]
+
strlen
(
argv
[
1
])
-
4
,
"_mpu.csv
\0
"
);
mpuFile
=
fopen
(
argv
[
1
],
"w+"
);
argv
[
1
][
strlen
(
argv
[
1
])
-
8
]
=
'\0'
;
}
if
(
mpuFile
==
NULL
){
if
(
mpuFile
==
NULL
){
printf
(
"Failed to open mpu output file
\n
"
);
printf
(
"Failed to open mpu output file
\n
"
);
return
0
;
return
0
;
}
}
}
// }else{
// strcpy(argv[1] + strlen(argv[1])-4, "_mpu.csv\0");
// mpuFile = fopen(argv[1], "w+");
// argv[1][strlen(argv[1])-8] = '\0';
// }
char
*
dmaBlock
=
(
char
*
)
malloc
(
hdr
.
dmaBlockSize
);
char
*
dmaBlock
=
(
char
*
)
malloc
(
hdr
.
dmaBlockSize
);
char
*
additionnalDataBlock
=
(
char
*
)
malloc
(
hdr
.
sizeOfAdditionnalDataBuffer
);
char
*
additionnalDataBlock
=
(
char
*
)
malloc
(
hdr
.
sizeOfAdditionnalDataBuffer
);
char
*
samples
=
(
char
*
)
malloc
(
hdr
.
numberOfChan
*
resolutionBytes
);
char
*
samples
=
(
char
*
)
malloc
(
hdr
.
numberOfChan
*
resolutionBytes
);
...
@@ -213,8 +215,10 @@ int main(int argc, char* argv[]){
...
@@ -213,8 +215,10 @@ int main(int argc, char* argv[]){
// read each dataBlock
// read each dataBlock
do
{
do
{
fread
(
additionnalDataBlock
,
hdr
.
sizeOfAdditionnalDataBuffer
,
1
,
logfile
);
fread
(
additionnalDataBlock
,
hdr
.
sizeOfAdditionnalDataBuffer
,
1
,
logfile
);
if
(
mpuFile
!=
NULL
){
parseMPU
(
additionnalDataBlock
,
hdr
.
sizeOfAdditionnalDataBuffer
,
isFirst
&&
verbose
,
mpuFile
);
parseMPU
(
additionnalDataBlock
,
hdr
.
sizeOfAdditionnalDataBuffer
,
isFirst
&&
verbose
,
mpuFile
);
isFirst
=
false
;
isFirst
=
false
;
}
fread
(
dmaBlock
,
hdr
.
dmaBlockSize
,
1
,
logfile
);
fread
(
dmaBlock
,
hdr
.
dmaBlockSize
,
1
,
logfile
);
for
(
isample
=
0
;
isample
<
dataBlockSampleSize
;
isample
++
){
for
(
isample
=
0
;
isample
<
dataBlockSampleSize
;
isample
++
){
for
(
ichan
=
0
;
ichan
<
hdr
.
numberOfChan
;
ichan
++
){
for
(
ichan
=
0
;
ichan
<
hdr
.
numberOfChan
;
ichan
++
){
...
@@ -229,6 +233,8 @@ int main(int argc, char* argv[]){
...
@@ -229,6 +233,8 @@ int main(int argc, char* argv[]){
printf
(
"
\r\n
"
);
printf
(
"
\r\n
"
);
fclose
(
wavfile
);
fclose
(
wavfile
);
fclose
(
logfile
);
fclose
(
logfile
);
if
(
mpuFile
!=
NULL
){
fclose
(
mpuFile
);
fclose
(
mpuFile
);
}
return
0
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment