Simulates a diffusion network by creating a random dynamic network and adoption threshold levels.
rdiffnet_multiple(R, statistic, ..., ncpus = 1L, cl = NULL) rdiffnet(n, t, seed.nodes = "random", seed.p.adopt = 0.05, seed.graph = "scale-free", rgraph.args = list(), rewire = TRUE, rewire.args = list(), threshold.dist = runif(n), exposure.args = list(), name = "A diffusion network", behavior = "Random contagion", stop.no.diff = TRUE)
| R | Integer scalar. Number of simulations to be done. |
|---|---|
| statistic | A Function to be applied to each simulated diffusion network. |
| ... | Further arguments to be passed to |
| ncpus | Integer scalar. Number of processors to be used (see details). |
| cl | An object of class |
| n | Integer scalar. Number of vertices. |
| t | Integer scalar. Time length. |
| seed.nodes | Either a character scalar or a vector. Type of seed nodes (see details). |
| seed.p.adopt | Numeric scalar. Proportion of early adopters. |
| seed.graph | Baseline graph used for the simulation (see details). |
| rgraph.args | List. Arguments to be passed to rgraph. |
| rewire | Logical scalar. When TRUE, network slices are generated by rewiring
(see |
| rewire.args | List. Arguments to be passed to |
| threshold.dist | Either a function to be applied via |
| exposure.args | List. Arguments to be passed to |
| name | Character scalar. Passed to |
| behavior | Character scalar. Passed to |
| stop.no.diff | Logical scalar. When |
A random diffnet
class object.
rdiffnet_multiple
returns either a vector or an array depending
on what statistic
is (see sapply
and
parSapply
).
Instead of randomizing whether an individual adopts the innovation or not, this toy model randomizes threshold levels, seed adopters and network structure, so an individual adopts the innovation in time \(T\) iff his exposure is above or equal to his threshold. The simulation is done in the following steps:
Using seed.graph
, a baseline graph is created.
Given the baseline graph, the set of initial adopters is defined
using seed.nodes
.
Afterwards, if rewire=TRUE
\(t-1\) slices of the network are created
by iteratively rewiring the baseline graph.
The threshold.dist
function is applied to each node in the graph.
Simulation starts at \(t=2\) assigning adopters in each time period accordingly to each vertex's threshold and exposure.
When seed.nodes
is a character scalar it can be "marginal"
, "central"
or "random"
,
So each of these values sets the initial adopters using the vertices with lowest
degree, with highest degree or completely randomly. The number of early adoptes
is set as seed.p.adopt * n
. Please note that when marginal nodes are
set as seed it may be the case that no diffusion process is attained as the
chosen set of first adopters can be isolated. Any other case will be considered
as an index (via [<-
methods), hence the user can manually set the set of initial adopters, for example
if the user sets seed.nodes=c(1, 4, 7)
then nodes 1, 4 and 7 will be
selected as initial adopters.
The argument seed.graph
can be either a function that generates a graph
(Any class of accepted graph format (see netdiffuseR-graphs
)), a
graph itself or a character scalar in which the user sets the algorithm used to
generate the first network (network in t=1), this can be either "scale-free"
(Barabasi-Albert model using the rgraph_ba
function, the default),
"bernoulli"
(Erdos-Renyi model using the rgraph_er
function),
or "small-world"
(Watts-Strogatz model using the rgraph_ws
function). The list rgraph.args
passes arguments to the chosen algorithm.
When rewire=TRUE
, the networks that follow t=1 will be generated using the
rewire_graph
function as \(G(t) = R(G(t-1))\), where \(R\)
is the rewiring algorithm.
If a function, the argument threshold.dist
sets the threshold for each vertex in the graph.
It is applied using sapply
as follows
sapply(1:n, threshold.dist)
By default sets the threshold to be random for each node in the graph.
If seed.graph
is provided, no random graph is generated and the simulation
is applied using that graph instead.
rewire.args
has the following default options:
p | |
.1 | |
undirected | |
getOption("diffnet.undirected", FALSE) | |
self | |
getOption("diffnet.self", FALSE) | |
exposure.args
has the following default options:
outgoing | |
TRUE | |
valued | |
getOption("diffnet.valued", FALSE) | |
normalized | |
TRUE | |
The function rdiffnet_multiple
is a wrapper of rdiffnet
wich allows
simulating multiple diffusion networks with the same parameters and apply
the same function to all of them. This function is designed to allow the user
to perform larger simulation studies in which the distribution of a particular
statistic is observed.
When cl
is provided, then simulations are done via
parSapply
. If ncpus
is greater than
1, then the function creates a cluster via makeCluster
which is stopped (removed) once the process is complete.
Other simulation functions: permute_graph
,
rewire_graph
, rgraph_ba
,
rgraph_er
, rgraph_ws
,
ring_lattice
# Asimple example ----------------------------------------------------------- set.seed(123) z <- rdiffnet(100,10) z#> Dynamic network of class -diffnet- #> Name : A diffusion network #> Behavior : Random contagion #> # of nodes : 100 (1, 2, 3, 4, 5, 6, 7, 8, ...) #> # of time periods : 10 (1 - 10) #> Type : directed #> Final prevalence : 0.19 #> Static attributes : real_threshold (1) #> Dynamic attributes : -summary(z)#> Diffusion network summary statistics #> Name : A diffusion network #> Behavior : Random contagion #> ----------------------------------------------------------------------------- #> Period Adopters Cum Adopt. (%) Hazard Rate Density Moran's I (sd) #> -------- ---------- ---------------- ------------- --------- ---------------- #> 1 5 5 (0.05) - 0.01 -0.02 (0.06) #> 2 2 7 (0.07) 0.02 0.01 0.14 (0.07) ** #> 3 0 7 (0.07) 0.00 0.01 0.14 (0.06) ** #> 4 1 8 (0.08) 0.01 0.01 0.11 (0.06) * #> 5 1 9 (0.09) 0.01 0.01 0.25 (0.07) *** #> 6 2 11 (0.11) 0.02 0.01 0.14 (0.06) ** #> 7 1 12 (0.12) 0.01 0.01 0.15 (0.06) *** #> 8 1 13 (0.13) 0.01 0.01 0.09 (0.07) #> 9 3 16 (0.16) 0.03 0.01 0.22 (0.07) *** #> 10 3 19 (0.19) 0.04 0.01 0.26 (0.07) *** #> ----------------------------------------------------------------------------- #> Left censoring : 0.05 (5) #> Right centoring : 0.81 (81) #> # of nodes : 100 #> #> Moran's I was computed on contemporaneous autocorrelation using 1/geodesic #> values. Significane levels *** <= .01, ** <= .05, * <= .1.# A more complex example: Adopt if at least one neighbor has adopted -------- y <- rdiffnet(100, 10, threshold.dist=function(x) 1, exposure.args=list(valued=FALSE, normalized=FALSE)) # Re thinking the Adoption of Tetracycline ---------------------------------- newMI <- rdiffnet(seed.graph = medInnovationsDiffNet$graph, threshold.dist = threshold(medInnovationsDiffNet), rewire=FALSE) # Simulation study comparing the diffusion with diff sets of seed nodes ----- # Random seed nodes set.seed(1) ans0 <- rdiffnet_multiple(R=50, statistic=function(x) sum(!is.na(x$toa)), n = 100, t = 4, seed.nodes = "random", stop.no.diff=FALSE)#> Warning: No diffusion in this network.


Hi. I'm Jesse Luoto, a front-end web developer. Here's a showcase of my previous work.
I'm ambitious and extremely skilled front-end developer. I love to code and live to hack. My worldview is strongly entrepreneurship-oriented. That's why my dream is to be an enterpreneur one day. I always enjoy learning and feel very natural when teaching.
And no, I'm not a designer.
Penetration is a browser game made in 48 hours. The target is to protect your planet from forthcoming asteroids. The game was made in Mood Jam 2013, to achieve the exact mood of the song Iggy and The Stooges - Penetration.
Penetration is made by using only JavaScript and HTML5 (Canvas). The game is built on top of CreateJS, a framework that is programmed to support thousands of simultaneous sprites on-screen. Game is mobile optimized and runs 30fps on the first iPad.
uQuery is a port of jQuery 1.6 to Unity3D. Unity uses very flexible JScript.NET programming language, that has many familiarities to JavaScript. That's why many web developes feel natural to start coding with Unity.
I really love jQuery and I really love Unity. So why not to combine the two? As a weekend project, I started to port functionalities of jQuery to Unity
uQuery is not yet a complete port of actual jQuery, but it allows usage of many most frequently used jQuery commands. I started by reading and translating the code line by line and hacked workarounds when ever needed to.
Long name of the project is "Facebook Page events sync to Google Calendar". That pretty much describes it's functionality. The bonus is, that you can also embed the hybrid calendar to any website.
The service is really easy to use, because you can embed the resulting calendar snippet to any website. The snippet uses SSL-secured REST API to fetch and update your calendar's data.
Fixtop is a simple jQuery plugin that gives any HTML element the ability to be always on the screen. If you try to scroll the "fixtopped" item away from the screen, it will be stacked to the top of the page.
jQuery is a great tool, because it allows others to built their own tools to extend the service. I'm always looking for ways to help my own work, as well as to help everyone else. That's why I love to do plugins and extensions, that can are easy-to-use.


8 writes to VerboseOutputPipe
System.Management.Automation (8)
engine\hostifaces\Command.cs (1)
407
mcr.
VerboseOutputPipe
= GetRedirectionPipe(toType, mcr);
engine\MshCommandRuntime.cs (1)
2183
this.
VerboseOutputPipe
= fromRuntime.VerboseOutputPipe;
engine\runtime\Operations\MiscOps.cs (6)
267
commandProcessor.CommandRuntime.
VerboseOutputPipe
= context.ExpressionVerboseOutputPipe;
295
commandProcessor.CommandRuntime.
VerboseOutputPipe
= context.CurrentCommandProcessor.CommandRuntime.VerboseOutputPipe;
944
commandProcessor.CommandRuntime.
VerboseOutputPipe
= pipe;
957
commandProcessor.CommandRuntime.
VerboseOutputPipe
= pipe;
1069
commandProcessor.CommandRuntime.
VerboseOutputPipe
= pipe;
1089
commandProcessor.CommandRuntime.
VerboseOutputPipe
= pipe;
7 references to VerboseOutputPipe
System.Management.Automation (7)
engine\MshCommandRuntime.cs (5)
591
if (
VerboseOutputPipe
!= null)
594
VerboseOutputPipe
.NullPipe)
605
VerboseOutputPipe
.Add(verboseWrap);
2181
if (fromRuntime.
VerboseOutputPipe
!= null)
2183
this.VerboseOutputPipe = fromRuntime.
VerboseOutputPipe
;
engine\runtime\Operations\MiscOps.cs (2)
293
context.CurrentCommandProcessor.CommandRuntime.
VerboseOutputPipe
!= null)
295
commandProcessor.CommandRuntime.VerboseOutputPipe = context.CurrentCommandProcessor.CommandRuntime.
VerboseOutputPipe
;


{{hideCurrentPassword ? 'visibility' : 'visibility_off'}}
Please enter a your current password
{{hideNewPassword ? 'visibility' : 'visibility_off'}}
Please enter a new password
{{hideNewPassword ? 'visibility' : 'visibility_off'}}
Please confirm your new password


Sorry, our records indicate that you have attempted to complete this study, but quit before finishing.
Because this is a Psychology experiment, you can only complete this study once.
Sorry, our records indicate that you have already completed (or attempted to complete) this study.
Because this is a Psychology experiment, you can only complete this study once.
Sorry, there was an unexpected error in our processing of your study.
If you feel that you have reached this page in error, please email {{ @contact_address }} and send the following information:
Error: #{{ @errornum }}
Unique Id: #{{ @prolificid }}


org.apache.archiva.redback.authorization
Classes
AuthorizationDataSource
AuthorizationException
AuthorizationResult
Authorizer
NotAuthorizedException
RedbackAuthorization
UnauthorizedException


Enter a word in the search bar. A quote with the word will turn up. Fill in the missing gap with the correct word from the options below!
Enter a word in the search bar. A quote with the word will turn up. Fill in the missing gap with the correct word from the options below!


Drag this link to your bookmarks bar to install:
Now find a web page with a long article. Click the Columnate bookmarklet to reformat the page free of distractions. The article will be formatted in narrow columns like a newspaper.
Visit the Columnate project page for more information or to report issues.


Real tools
So, I was discussing with Clochix on the future of mobile/apps/the web, what are the costs for developers today to target as much platforms as possible, etc.
And then someone popped up in the discussion (and that’s cool, that’s the reason we’re having these discussions on Twitter), to comment on HTML5 tooling: (translation is mine)
devs prefer coding with real tools and users prefer real apps.
Clochix answered constructively asking for reference for this claim as well as definitions for “real tools” and “real apps” (“Facebook apps, Linkedin apps and the iOS ecosystem”). That intervention pissed me off (“real”) and since I’m a human being, I make mistakes so I answered unconstructively that as a real dev, I only work with real butterflies.
I feel this topic deserves a broader coverage, so I’d like to talk about my favorite tools to build web applications and software in general. So here is my list of real tools I use as a real developer in no particular order.
 It’s an amazing tool to think abstractly, model data, combine ideas. Our brains develop habits which make us faster and better at what we do over time usually. We have to be careful about forgetting our habits when they get in the way of moving forward, though.
With my brain, I can project myself in the future, imagine the maintanability problems in advance and lead to ways to avoid them in the present.
With my brain, I’m capable of cutting a problem into subproblems that can each be solved independently.
With my brain, I can bridge my understanding of a problem with the vocabulary the web platform provides to produce a solution to the problem.
 Since my brain is very limited in capacity, I dump occasionally its content to MDN, so I can refer to it later. The MDN team is indeed making sure the website is up as much as possible.
This sounds like an obvious one, but I see too often devs rushing to their computers when a walk would probably be more effective.
Voice, email and patience
The vast majorit…. well… all the time, I build software for someone else’s need. I must translate their intent into code. My main task is to get their intent out of their brain. If I fail at this task, the code I write is most likely a waste of time.
Among other difficulties, most of the time, people don’t know what they want. Even if they do, they most often lack the proper vocabulary to express it. It’s a frustrating situation, but one we have to deal with just all the time.
It takes discussing, exchanging, expanding people’s vocabulary. It takes building something, gathering feedback, iterating. But not doing so results in endless cycles of disatisfaction about what’s being built… well… or you can screw your client over, but I always aim at success…
It’s a lot of work. Communication. Among other things, it involves cross-cultural concerns (not talking about cultures as in nationality, but culture in a broader sense), making sure the tone is right, seduction sometimes, manipulation in rarer occasions.
It helps a lot not wasting time, though.
I quite intentionally plan to master this art. Much more seriously than I plan to master the command line. We’re building software for people.
Aw maaaan, this is my favorite actually. In my second year of software engineering school, I got involved in a project with a group of students and we had a room assigned for us. It had a whiteboard. Team design discussions in front of a whiteboard are just the best!
I miss whiteboards… I miss a team too, but that’s another topic, which leads me to…
A team
Not sure how ethical it is to consider a team a tool, but moving on…
Other people are amazing at seeing errors you make because they most often think from a different perspective. No later than a couple of weeks ago, I thought of a project and just discussing it over lunch with Thomas Parisot made me realize it was much more easier to do it as a Chrome extension than something with a server (Clochix would be proud). Bim! Saved hours messing around with server settings and going back and forth between browser APIs and Node APIs, just like that, over lunch.
A team is good for code review, for keeping things moving when you’re not at your best, for telling you to write test when you’d be lazy about it, for telling you how to promote your projects.
Teams are good.
Conclusive note
Tools like SDKs, frameworks, I can Google about them and given a few hours, I’ll know what to pick. In a few hours, I can find one excellent way to customize my CLI and I bet you the code to do it is even open source.
As far as I’m concerned, the tools I listed in this post are the ones that make a massive difference in my productivity. The rest of my tooling is a replaceable distraction. Coding itself sometimes feels like an annoying burden after the work of understanding the problem is done.
Please wake me up when the non-debates about Grunt vs Gulp or Ember vs Angular or MVC vs MV*MCC|PVM² are over. I’m making a nap so my brain rests


fooof.FOOOFGroup¶
-
class
fooof.
FOOOFGroup
(*args, **kwargs)[source]¶ Model a group of power spectra as a combination of aperiodic and periodic components.
WARNING: FOOOF expects frequency and power values in linear space.
Passing in logged frequencies and/or power spectra is not detected, and will silently produce incorrect results.
- Parameters
- peak_width_limitstuple of (float, float), optional, default: (0.5, 12.0)
Limits on possible peak width, as (lower_bound, upper_bound).
- max_n_peaksint, optional, default: inf
Maximum number of gaussians to be fit in a single spectrum.
- min_peak_heightfloat, optional, default: 0
Absolute threshold for detecting peaks, in units of the input data.
- peak_thresholdfloat, optional, default: 2.0
Relative threshold for detecting peaks, in units of standard deviation of the input data.
- aperiodic_mode{‘fixed’, ‘knee’}
Which approach to take for fitting the aperiodic component.
- verbosebool, optional, default: True
Verbosity mode. If True, prints out warnings and general status updates.
Notes
Commonly used abbreviations used in this module include: CF: center frequency, PW: power, BW: Bandwidth, AP: aperiodic
Input power spectra must be provided in linear scale. Internally they are stored in log10 scale, as this is what the model operates upon.
Input power spectra should be smooth, as overly noisy power spectra may lead to bad fits. For example, raw FFT inputs are not appropriate. Where possible and appropriate, use longer time segments for power spectrum calculation to get smoother power spectra, as this will give better model fits.
The gaussian params are those that define the gaussian of the fit, where as the peak params are a modified version, in which the CF of the peak is the mean of the gaussian, the PW of the peak is the height of the gaussian over and above the aperiodic component, and the BW of the peak, is 2*std of the gaussian (as ‘two sided’ bandwidth).
The FOOOFGroup object inherits from the FOOOF object. As such it also has data attributes (power_spectrum & fooofed_spectrum_), and parameter attributes (aperiodic_params_, peak_params_, gaussian_params_, r_squared_, error_) which are defined in the context of individual model fits. These attributes are used during the fitting process, but in the group context do not store results post-fitting. Rather, all model fit results are collected and stored into the group_results attribute. To access individual parameters of the fit, use the get_params method.
- Attributes
- freqs1d array
Frequency values for the power spectra.
- power_spectra2d array
Power values for the group of power spectra, as [n_power_spectra, n_freqs]. Power values are stored internally in log10 scale.
- freq_rangelist of [float, float]
Frequency range of the power spectra, as [lowest_freq, highest_freq].
- freq_resfloat
Frequency resolution of the power spectra.
- group_resultslist of FOOOFResults
Results of FOOOF model fit for each power spectrum.
has_data
boolIndicator for if the object contains data.
has_model
boolIndicator for if the object contains model fits.
n_peaks_
intHow many peaks were fit for each model.
- n_failed_fits_int
The number of models that failed to fit.
- failed_fit_inds_list of int
The indices of any models that failed to fit.
Methods
__init__
(self, \*args, \*\*kwargs)Initialize object with desired settings.
add_data
(self, freqs, power_spectra[, …])Add data (frequencies and power spectrum values) to the current object.
add_meta_data
(self, fooof_meta_data)Add data information into object from a FOOOFMetaData object.
add_results
(self, fooof_result)Add results data into object from a FOOOFResults object.
add_settings
(self, fooof_settings)Add settings into object from a FOOOFSettings object.
copy
(self)Return a copy of the current object.
drop
(self, inds)Drop one or more model fit results from the object.
fit
(self[, freqs, power_spectra, …])Fit a group of power spectra.
get_fooof
(self, ind[, regenerate])Get a FOOOF object for a specified model fit.
get_group
(self, inds)Get a FOOOFGroup object with the specified sub-selection of model fits.
get_meta_data
(self)Return data information from the current object.
get_params
(self, name[, col])Return model fit parameters for specified feature(s).
get_results
(self)Return the results run across a group of power spectra.
get_settings
(self)Return user defined settings of the current object.
load
(self, file_name[, file_path])Load FOOOFGroup data from file.
plot
(self[, save_fig, file_name, file_path])Plot a figure with subplots visualizing the parameters from a FOOOFGroup object.
print_report_issue
([concise])Prints instructions on how to report bugs and/or problematic fits.
print_results
(self[, concise])Print out FOOOFGroup results.
print_settings
(self[, description, concise])Print out the current settings.
report
(self[, freqs, power_spectra, …])Fit a group of power spectra and display a report, with a plot and printed results.
save
(self, file_name[, file_path, append, …])Save out results and/or settings from FOOOFGroup object.
save_report
(self, file_name[, file_path])Generate and save out a PDF report for a group of power spectrum models.
set_debug_mode
(self, debug)Set whether debug mode, wherein an error is raised if fitting is unsuccessful.
Attributes
Indicator for if the object contains data.
Indicator for if the object contains model fits.
How many model fits are null.
How many peaks were fit for each model.
The indices for model fits that are null.
-
add_data
(self, freqs, power_spectra, freq_range=None)[source]¶ Add data (frequencies and power spectrum values) to the current object.
- Parameters
- freqs1d array
Frequency values for the power spectra, in linear space.
- power_spectra2d array, shape=[n_power_spectra, n_freqs]
Matrix of power values, in linear space.
- freq_rangelist of [float, float], optional
Frequency range to restrict power spectra to. If not provided, keeps the entire range.
Notes
If called on an object with existing data and/or results these will be cleared by this method call.
-
add_meta_data
(self, fooof_meta_data)¶ Add data information into object from a FOOOFMetaData object.
- Parameters
- fooof_meta_dataFOOOFMetaData
A meta data object containing meta data information.
-
add_results
(self, fooof_result)¶ Add results data into object from a FOOOFResults object.
- Parameters
- fooof_resultFOOOFResults
A data object containing the results from fitting a FOOOF model.
-
add_settings
(self, fooof_settings)¶ Add settings into object from a FOOOFSettings object.
- Parameters
- fooof_settingsFOOOFSettings
A data object containing the settings for a FOOOF model.
-
copy
(self)¶ Return a copy of the current object.
-
drop
(self, inds)[source]¶ Drop one or more model fit results from the object.
- Parameters
- indsint or array_like of int or array_like of bool
Indices to drop model fit results for. If a boolean mask, True indicates indices to drop.
Notes
This method sets the model fits as null, and preserves the shape of the model fits.
-
fit
(self, freqs=None, power_spectra=None, freq_range=None, n_jobs=1, progress=None)[source]¶ Fit a group of power spectra.
- Parameters
- freqs1d array, optional
Frequency values for the power_spectra, in linear space.
- power_spectra2d array, shape: [n_power_spectra, n_freqs], optional
Matrix of power spectrum values, in linear space.
- freq_rangelist of [float, float], optional
Desired frequency range to run FOOOF on. If not provided, fits the entire given range.
- n_jobsint, optional, default: 1
Number of jobs to run in parallel. 1 is no parallelization. -1 uses all available cores.
- progress{None, ‘tqdm’, ‘tqdm.notebook’}, optional
Which kind of progress bar to use. If None, no progress bar is used.
Notes
Data is optional, if data has already been added to the object.
-
get_fooof
(self, ind, regenerate=True)[source]¶ Get a FOOOF object for a specified model fit.
- Parameters
- indint
The index of the FOOOFResults in FOOOFGroup.group_results to load.
- regeneratebool, optional, default: False
Whether to regenerate the model fits from the given fit parameters.
- Returns
- fmFOOOF
The FOOOFResults data loaded into a FOOOF object.
-
get_group
(self, inds)[source]¶ Get a FOOOFGroup object with the specified sub-selection of model fits.
- Parameters
- indsarray_like of int or array_like of bool
Indices to extract from the object. If a boolean mask, True indicates indices to select.
- Returns
- fgFOOOFGroup
The requested selection of results data loaded into a new FOOOFGroup object.
-
get_meta_data
(self)¶ Return data information from the current object.
- Returns
- FOOOFMetaData
Object containing meta data from the current object.
-
get_params
(self, name, col=None)[source]¶ Return model fit parameters for specified feature(s).
- Parameters
- name{‘aperiodic_params’, ‘peak_params’, ‘gaussian_params’, ‘error’, ‘r_squared’}
Name of the data field to extract across the group.
- col{‘CF’, ‘PW’, ‘BW’, ‘offset’, ‘knee’, ‘exponent’} or int, optional
Column name / index to extract from selected data, if requested. Only used for name of {‘aperiodic_params’, ‘peak_params’, ‘gaussian_params’}.
- Returns
- outndarray
Requested data.
- Raises
- NoModelError
If there are no model fit results available.
- ValueError
If the input for the col input is not understood.
Notes
For further description of the data you can extract, check the FOOOFResults documentation.
-
get_settings
(self)¶ Return user defined settings of the current object.
- Returns
- FOOOFSettings
Object containing the settings from the current object.
-
has_data
¶ Indicator for if the object contains data.
-
has_model
¶ Indicator for if the object contains model fits.
-
load
(self, file_name, file_path=None)[source]¶ Load FOOOFGroup data from file.
- Parameters
- file_namestr
File to load data from.
- file_pathstr, optional
Path to directory to load from. If None, loads from current directory.
-
n_null_
¶ How many model fits are null.
-
n_peaks_
¶ How many peaks were fit for each model.
-
null_inds_
¶ The indices for model fits that are null.
-
plot
(self, save_fig=False, file_name=None, file_path=None)[source]¶ Plot a figure with subplots visualizing the parameters from a FOOOFGroup object.
- Parameters
- save_figbool, optional, default: False
Whether to save out a copy of the plot.
- file_namestr, optional
Name to give the saved out file.
- file_pathstr, optional
Path to directory to save to. If None, saves to current directory.
- Raises
- NoModelError
If the FOOOF object does not have model fit data available to plot.
-
static
print_report_issue
(concise=False)¶ Prints instructions on how to report bugs and/or problematic fits.
- Parameters
- concisebool, optional, default: False
Whether to print the report in a concise mode, or not.
-
print_results
(self, concise=False)[source]¶ Print out FOOOFGroup results.
- Parameters
- concisebool, optional, default: False
Whether to print the report in a concise mode, or not.
-
print_settings
(self, description=False, concise=False)¶ Print out the current settings.
- Parameters
- descriptionbool, optional, default: False
Whether to print out a description with current settings.
- concisebool, optional, default: False
Whether to print the report in a concise mode, or not.
-
report
(self, freqs=None, power_spectra=None, freq_range=None, n_jobs=1, progress=None)[source]¶ Fit a group of power spectra and display a report, with a plot and printed results.
- Parameters
- freqs1d array, optional
Frequency values for the power_spectra, in linear space.
- power_spectra2d array, shape: [n_power_spectra, n_freqs], optional
Matrix of power spectrum values, in linear space.
- freq_rangelist of [float, float], optional
Desired frequency range to run FOOOF on. If not provided, fits the entire given range.
- n_jobsint, optional, default: 1
Number of jobs to run in parallel. 1 is no parallelization. -1 uses all available cores.
- progress{None, ‘tqdm’, ‘tqdm.notebook’}, optional
Which kind of progress bar to use. If None, no progress bar is used.
Notes
Data is optional, if data has already been added to the object.
-
save
(self, file_name, file_path=None, append=False, save_results=False, save_settings=False, save_data=False)[source]¶ Save out results and/or settings from FOOOFGroup object. Saves out to a JSON file.
- Parameters
- file_namestr or FileObject
File to save data to.
- file_pathstr, optional
Path to directory to load from. If None, loads from current directory.
- appendbool, optional, default: False
Whether to append to an existing file, if available. This option is only valid (and only used) if ‘file_name’ is a str.
- save_resultsbool, optional
Whether to save out FOOOF model fit results.
- save_settingsbool, optional
Whether to save out FOOOF settings.
- save_databool, optional
Whether to save out power spectra data.
- Raises
- ValueError
If the data or save file specified are not understood.
-
save_report
(self, file_name, file_path=None)[source]¶ Generate and save out a PDF report for a group of power spectrum models.
- Parameters
- file_namestr
Name to give the saved out file.
- file_pathstr, optional
Path to directory to save to. If None, saves to current directory.
-
set_debug_mode
(self, debug)¶ Set whether debug mode, wherein an error is raised if fitting is unsuccessful.
- Parameters
- debugbool
Whether to run in debug mode.


Toggle navigation
Arcus
Go Back
Dashboard
Search
Helpdesk
Performance
Personal
Professional
Home
Profile
With Fitbit:
click here
Goal Steps
Goal Calories out
Goal Distance
Goal Floor
Profile Tab


Scotiabank donates $1.25 million to University of Alberta for AI research
The university will use the donation to create practical tools and develop predictive models
by Aisha MalikScotiabank announced that it donated $1.25 million CAD to the University of Alberta to fund an artificial intelligence research initiative.
The donation will go towards the Scotiabank Artificial Intelligence Research Initiative. The initiative aims to build practical tools and develop predictive models for fraud detection and speech to text analytics.
“Our partnerships with academia are fostering the next generation of talent by building communities of practice for artificial intelligence and machine learning,” said Mark Wagner, the vice president of Analytics Practice and Corporate Functions at Scotiabank, in a press release.
The investment will also support the growth and development on women in science, technology, engineering and mathematics (STEM).
Scotiabank says that it has already successfully used artificial intelligence and illustrated the technology’s potential by providing customized services.
Source: Scotiabank


Very often while writing programs we’ll run into cases where we’ll have to execute the same set of steps, over and over again. In those cases, it probably wouldn’t make sense to rewrite the same statements multiple times. That’s when Subroutines come in handy.
A subroutine is a portion of code within a larger program that usually does something very specific, and that can be called from anywhere in the program. Subroutines are identified by a name that follows the Sub keyword and are terminated by the EndSub keyword. For example, the following snippet represents a subroutine whose name is PrintTime, and it does the job of printing the current time to the TextWindow.
Sub PrintTime
TextWindow.WriteLine(Clock.Time)
EndSub
Below is a program that includes the subroutine and calls it from various places.
PrintTime()
TextWindow.Write("Enter your name: ")
name = TextWindow.Read()
TextWindow.Write(name + ", the time now is: ")
PrintTime()
Sub PrintTime
TextWindow.WriteLine(Clock.Time)
EndSub
Figure 9.1 - Calling a simple Subroutine
You execute a subroutine by calling SubroutineName(). As usual, the punctuators “()” are necessary to tell the computer that you want to execute a subroutine.
As we just saw above, subroutines help reduce the amount of code you have to type in. Once you have the PrintTime subroutine written, you can call it from anywhere in your program and it’ll print the current time.
Note: Remember, you can only call a SmallBasic subroutine from within the same program. You cannot call a subroutine from within another program.
In addition, subroutines can help decompose complex problems into simpler pieces. Say you had a complex equation to solve, you can write several subroutines that solved smaller pieces of the complex equation. Then you can put the results together to get the solution to the original complex equation.
Subroutines can also aid in improving the readability of a program. In other words, if you have well named subroutines for commonly run portions of your program, your program becomes easy to read and comprehend. This is very important if you want to understand someone else’s program or if you want your program to be understood by others. Sometimes, it is helpful even when you want to read your own program, say a week after you wrote it.
You can access and use any variable that you have in a program from within a subroutine. As an example, the following program accepts two numbers and prints out the larger of the two. Notice that the variable max is used both inside and outside of the subroutine.
TextWindow.Write("Enter first number: ")
num1 = TextWindow.ReadNumber()
TextWindow.Write("Enter second number: ")
num2 = TextWindow.ReadNumber()
FindMax()
TextWindow.WriteLine("Maximum number is: " + max)
Sub FindMax
If (num1 > num2) Then
max = num1
Else
max = num2
EndIf
EndSub
And the output of this program looks like this.
Figure 9.2 - Max of two numbers using Subroutine
Let’s look at another example that will illustrate the usage of Subroutines. This time we’ll use a graphics program that computes various points which it will store in variables x and y. Then it calls a subroutine DrawCircleUsingCenter which is responsible for drawing a circle using x and y as the center
GraphicsWindow.BackgroundColor = "Black"
GraphicsWindow.PenColor = "LightBlue"
GraphicsWindow.Width = 480
For i = 0 To 6.4 Step 0.17
x = Math.Sin(i) * 100 + 200
y = Math.Cos(i) * 100 + 200
DrawCircleUsingCenter()
EndFor
Sub DrawCircleUsingCenter
startX = x - 40
startY = y - 40
GraphicsWindow.DrawEllipse(startX, startY, 120, 120)
EndSub
Figure 9.3 - Graphics Example for Subroutines
Here is the general format for how programs should be organized. Following this will make sure the programs work properly and are also easy to follow for someone looking at them.
Sometimes subroutines get called from inside a loop, during which time they execute the same set of statements but with different values in one or more of the variables. For instance, say if you have a subroutine named PrimeCheck and this subroutine determines if a number is prime or not. You can write a program that lets the user to enter a value and you can then say if it is prime or not, using this subroutine. The program below illustrates that.
TextWindow.Write("Enter a number: ")
i = TextWindow.ReadNumber()
isPrime = "True"
PrimeCheck()
If (isPrime = "True") Then
TextWindow.WriteLine(i + " is a prime number")
Else
TextWindow.WriteLine(i + " is not a prime number")
EndIf
Sub PrimeCheck
For j = 2 To Math.SquareRoot(i)
If (Math.Remainder(i, j) = 0) Then
isPrime = "False"
Goto EndLoop
EndIf
Endfor
EndLoop:
EndSub
The PrimeCheck subroutine takes the value of i and tries to divide it by smaller numbers. If a number divides i and leaves no remainder, then i is not a prime number. At that point the subroutine sets the value of isPrime to “False” and exits. If the number was indivisible by smaller numbers then the value of isPrime remains as “True.”
Figure 9.4 - Prime Check
Now that you have a subroutine that can do the Prime test for us, you might want to use this to list out all the prime numbers below, say, 100. It is really easy to modify the above program and make the call to PrimeCheck from inside a loop. This gives the subroutine a different value to compute each time the loop is run. Let’s see how this is done with the example below.
For i = 3 To 100
isPrime = "True"
PrimeCheck()
If (isPrime = "True") Then
TextWindow.WriteLine(i)
EndIf
EndFor
Sub PrimeCheck
For j = 2 To Math.SquareRoot(i)
If (Math.Remainder(i, j) = 0) Then
isPrime = "False"
Goto EndLoop
EndIf
Endfor
EndLoop:
EndSub
In the program above, the value of i is updated every time the loop is run. Inside the loop, a call to the subroutine PrimeCheck is made. The subroutine PrimeCheck then takes the value of i and computes whether or not i is a prime number. This result is stored in the variable isPrime which is then accessed by the loop outside of the subroutine. The value of i is then printed if it turns out to be a prime number. And since the loop starts from 3 and goes up to 100, we get a list of all the prime numbers that are between 3 and 100. Below is the result of the program.
Figure 9.5 - Prime Numbers


Data Collection
Offline Optimization
Pilot
Simulation
Simulation Results
Online Optimization
Execution
New Data Set Output


Lions
Portrait Gallery ▼
About Us
The Warhost
Portrait Gallery
Groups of the Warhost
The Temple of Law
Albion Patriot
Map of Albion
Command Team
▼
Monarchs
Nobles
Knights
Middle Class
Peasants
Fallen Heroes
☙
❧