Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
advLigoRTS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
CDS
software
advLigoRTS
Commits
c6129f1e
Commit
c6129f1e
authored
2 years ago
by
Ezekiel Dohmen
Browse files
Options
Downloads
Patches
Plain Diff
Just GaussianNoise adding part perl script emitter
parent
7f650ca3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
4 merge requests
!439
RCG 5.0 release fro deb 10
,
!366
Merge with branch 4.2
,
!365
Merge branch 'branch-4.2' into master-branch-4.2-merge
,
!354
Adding gaussian noise part
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/epics/util/lib/GaussianNoise.pm
+92
-0
92 additions, 0 deletions
src/epics/util/lib/GaussianNoise.pm
with
92 additions
and
0 deletions
src/epics/util/lib/GaussianNoise.pm
0 → 100644
+
92
−
0
View file @
c6129f1e
package
CDS::
GaussianNoise
;
use
Exporter
;
@ISA
=
('
Exporter
');
#// \page GaussianNoise Noise.pm
#// Documentation for GaussianNoise.pm
#// This GaussianNoise part generates gaussian random noise around
#// the given mean with the given standard deviation.
#//
#//
#//
#// \n
$printed
=
0
;
$init_code_printed
=
0
;
1
;
sub
partType
{
return
GaussianNoise
;
}
# Print Epics communication structure into a header file
# Current part number is passed as first argument
sub
printHeaderStruct
{
my
(
$i
)
=
@_
;
}
# Print Epics variable definitions
# Current part number is passed as first argument
sub
printEpics
{
my
(
$i
)
=
@_
;
}
# Print variable declarations int front-end file
# Current part number is passed as first argument
sub
printFrontEndVars
{
my
(
$i
)
=
@_
;
print
::
OUT
"
static double
\L
$::xpartName[
$i
];
\n
";
if
(
$printed
)
{
return
;
}
print
::
OUT
<<
"
END
";
static
inline
double
gaussianRandomDouble
(
void
)
{
uint64_t
gaussRandomUint
;
ligo_get_random_bytes
(
&gaussRandomUint
,
sizeof
(
gaussRandomUint
));
return
qnorm5
(
((
double
)
gaussRandomUint
/0xFFFFFFFFFFFFFFFF), 0 /
*mean
*
/, 1/
*standard
deviation
*/
,
1
,
0
);
}
END
$printed
=
1
;
}
# Check inputs are connected
sub
checkInputConnect
{
my
(
$i
)
=
@_
;
return
"";
}
# Figure out part input code
# Argument 1 is the part number
# Argument 2 is the input number
# Returns calculated input code
sub
fromExp
{
my
(
$i
,
$j
)
=
@_
;
my
$from
=
$
::
partInNum
[
$i
][
$j
];
return
"
\L
$::xpartName[
$from
]
";
}
# Return front end initialization code
# Argument 1 is the part number
# Returns calculated code string
sub
frontEndInitCode
{
my
(
$i
)
=
@_
;
if
(
$init_code_printed
)
{
return
"";
}
my
$calcExp
=
"
\L
$::xpartName[
$i
] = 0;
\n
";
$init_code_printed
=
1
;
return
$calcExp
;
}
# Return front end code
# Argument 1 is the part number
# Returns calculated code string
sub
frontEndCode
{
my
(
$i
)
=
@_
;
my
$calcExp
=
"
// GaussiaNoise
\n
";
$calcExp
.=
"
\L
$::xpartName[
$i
] = gaussianRandomDouble(
"
.
.
"
,
"
.
.
"
);
\n
";
}
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