--- title: Options to install R on a Raspberry Pi and other ARM systems description: "Learn what options you have available for installing R on the Raspberry Pi SBC and other ARM systems." author: andres-castro date: '2023-02-11' slug: r_on_arm categories: - R series: - r-admin tags: - linux-arm - raspberry-pi draft: false images: ["r_on_arm.png"] authors: ["andres-castro"] output: blogdown::html_page: toc: true highlight: zenburn ---
This started out as a section in some of my other posts but as installation options started to pile up it began to take too much space to be just a section in an article so I’ve decided to turn it into an article of its own.
The options described here are mostly applicable to the Raspberry Pi family of Single Board Computers but since most options also work on Ubuntu distributions they can also be applicable to other Linux ARM systems like other SBCs or even “full-size” ARM computers like Ampere Altra or AWS Graviton.
This is the easiest option, you can install R from the standard repositories for your OS, but those R versions are usually quite old, for example, Raspberry Pi OS comes with R 4.0.0 and Ubuntu 22.04 comes with R 4.1.2.
To install R with this option you just need to run this command in your system terminal:
sudo apt install r-base
This is fine if you just want to try R or do simple stuff with it but if you are going to work on a serious project, chances are you want to start with an up-to-date version of R instead.
Another option is to compile the latest R version yourself (4.2.2 at the moment of writing) from the source code files, this is a time-consuming task and it might feel a little intimidating for newcomers but it gives you the most flexibility when it comes to set compilation options, for example, you can choose options like compiling with BLAS and LAPACK to speed up matrix calculations.
You can compile R from source by running this script on a system terminal, it works for both Raspberry Pi OS and Ubuntu distributions:
sudo su
# Set the R version to install
R_VERSION=4.2.2
apt install -y g++ gcc gfortran libreadline-dev libx11-dev libxt-dev \
\
libpng-dev libjpeg-dev libcairo2-dev xvfb \
libbz2-dev libzstd-dev liblzma-dev libtiff5 \
libssh-dev libgit2-dev libcurl4-openssl-dev \
libblas-dev liblapack-dev libopenblas-base \
zlib1g-dev openjdk-11-jdk \
texinfo texlive texlive-fonts-extra
screen wget libpcre2-dev make cmakecd /usr/local/src
wget https://cran.rstudio.com/src/base/R-${R_VERSION:0:1}/R-$R_VERSION.tar.gz
tar zxvf R-$R_VERSION.tar.gz
cd R-$R_VERSION
./configure --enable-R-shlib --enable-memory-profiling --with-blas --with-lapack #BLAS and LAPACK are optional
make
make install
cd ..
rm -rf R-$R_VERSION*
exit
rig
is an R installation manager that allows you to install multiple R versions side by side, it has recently added support for Linux ARM64 systems through the rstudio/r-builds
GitHub repository, although, these builds are stated to be a community resource, they are not professionally supported by Posit. It currently supports only Ubuntu and Debian distributions (Raspberry Pi OS is based on Debian 11 so it is compatible too).
You can install rig
in your system by running this command on a system terminal:
curl -Ls https://github.com/r-lib/rig/releases/download/latest/rig-linux-arm64-latest.tar.gz |
sudo tar xz -C /usr/local
Then you can install the latest stable R version with these commands:
sudo rig add release # Or an specific version like 4.2.2
sudo rig default release
Optionally, you can manually download and install R from R-hub as explained on the rstudio/r-builds
GitHub repository, but this is a more involved procedure only worthy if you are going to integrate this into your own infrastructure management workflow and you want to avoid the overhead of installing rig
.
And last but not least, my new favorite, you can install R from the R4Pi project through its deb repository, which means you will always get R version updates just by running sudo apt update && sudo apt upgrade
. Currently, it only supports Raspberry Pi OS, both 32 and 64 bits, and possibly other Debian 11 based distributions like Ubuntu 18, but it is not guaranteed.
To add the R4Pi deb repository to your deb source list and install R run these commands on a system terminal:
curl -O https://pkgs.r4pi.org/dl/r4pi-repo-conf_0.0.1-1_all.deb
sudo dpkg -i r4pi-repo-conf_0.0.1-1_all.deb
sudo apt update
sudo apt upgrade
sudo apt install r4pi
rm r4pi-repo-conf_0.0.1-1_all.deb
The main benefit of the R4Pi project is that it also provides R package repositories with precompiled binaries for a big selection of R packages which greatly reduces the time and effort required to install R packages on the Raspberry Pi, and by the way, you can also use the R4Pi package repository with all the previous installation options just by setting the “repos” option in a .Rprofile
file.
local({r <- getOption("repos")
"R4Pi"] <- "https://pkgs.r4pi.org/aarch64" # or "https://pkgs.r4pi.org/" for 32-bit systems
r["CRAN"] <- "https://cran.rstudio.com/" # Secondary repository for when no binary is available
r[options(repos=r)})


waveshaper: A sound processing module that takes the frequency generated by the {_oscillator} in the same {_channel}, and turns it into one of a number of possible wave shapes. The two basic shapes are "saws", which is a pair of sawtooth waves with a phase difference controlled by the Width parameter, and "pulse" which is a variable width pulse; the two have opposite harmonic spectra. The Digital Chroma also adds simple single-oscillator FM sounds with various carrier to modulator ratios, and can also modulate a sine wave by the opposite channel's oscillator or {_filter} output. Finally, it supports the "pink noise" and "white noise" choices that the original Chroma had, plus an "impulse" shape that is useful for pinging a highly {_resonance resonant} filter.
Also: {_oscillator}, {_filter}, {_amplifier}


Mock placement for the benefit of students.
*Round 1: Written Test (Technical & Aptitude)
In the written test round the participants must give a short written examination constituting of technical and aptitude questions to test their mental ability. The top few scoring participants will be selected for the next round.
Time Duration: 09:30 A.M to 11:30 A.M
Round 2: Group Discussion
In this round the selected participants will be placed in teams for a group discussion on a topic provided. This will test the communication skills and the ability of the student to participate in a group. Judges will select the best participants according to a list of criteria.
Time Duration: 12:30P.M to 3:00 P.M
Round 3: Personal Interview
The selected participants will now take part in a personal interview which simulates an interview during placements, testing the overall knowledge and confidence of the student.
RULES :
1. For a written test a cut off will be decided & on that basis, participants will be proceed further for second round
2. In G.D. the judging will be based on the communication skill, initiation ability, content.
3. For P.I. the judging will be done by the judges or the interviewer.
No team. Individual entry
7th March 2017
09:30 to 5:00 PM
Round 1 Class No:36,37; Round 2 and Round 3 in MH Dept., Narayan Bhavan
Rs. 50
SNEHANKIT THUMMER
9825158769
snehankitthummer0077@gmail.com


JavaScript Function Editor
built with lite-code-editor
and then use the web developer console for output!
Find more about lite-code-editor
in this demo,
on github,
or on npmjs.
Also take a look at js-func-editor and
the JSY transpiling jsy-func-editor.


Introduction
What are the Panama papers?
Panama papers are the leak of 11.5 millions documents. They describe details of evasion tax from the 1970s to 2015. For this project, we have access to the database of https://www.occrp.org/en/panamapapers/database. It contains four files describing different leaks of evasion tax: Panama papers, Bahamas leaks, Offshore leaks and Paradise papers. The goal of this project is to compile these four files to create an homogeneous database and extract relevant information. We focus on five research questions to show how evasion tax evolves over time and how significant this problem is.
Definition of important terms
Before going into the details, we start by defining important terms which will be used in this project.
Nodes and edges
This database can be represented as a graph. It contains nodes which are connected using edges. In this project, a node can be an officer, an intermediary or entity. It contains a country, a juridsiction and a creation date. An edge is a relation between two nodes, it contains a creation date, a deletion date, and the nature of the relation between the nodes.
Entity
An entity is an offshore company located in a country with low-tax. The goal of this company is to attract non-resident clients which send them their money. The idea is to reduce significantly the amount of tax paid by the clients.
Officer
An officer is the client of an entity, it can be a person or a company.
Intermediary
An intemediary is a middle person or company between an officer and an entity. It gets the money from the officer and signs the contract with the entity. The goal is the hide the officer from the contract.
Address
For intermediary, officer, and entity, the address is contained in another node called address. To retrive the address of those first nodes, you therefore need to follow the edges of type ‘address_of’.
Country vs Jurisdiction
Nodes can be defined by jurisdictions and origin countries. It is imporant to define the difference between those two terms. An origin country is the physical location an entity, while a jurisdiction is the country whose law the entity obeys to.
Relevant statistics about Panama papers
The database contains 1’906’686 nodes and 3’142’523 edges.
The node that has the most outgoing edges has 36373 outgoing edges and the node that has the most incoming edges has 37338 outgoing edges.
29.55% of edges have a start date and among those, 22.32% have an end date. They range from 1960-03-10 to 2015-12-31. Whereas the entities creation dates range from 1960-01-01 to 2015-12-31.
Some edges have the same start and end country. The top 3 countries with the most outgoing edges not pointing towards themselves are :
- Hong Kong with 169’161 outgoing edges
- USA with 105’267 outgoing edges.
- China with 94’434 outgoing edges.
Likewise, some edges have the same start and end jursidiction. The top 3 jurisdictions with the most incoming edges are :
- British Virgin Islands with 523’869 outgoing edges
- Malta with 214’848 outgoing edges.
- Bermuda with 154’931 outgoing edges.
We are considering start countries and end jurisdictions because relationships always go from people towards the entity. And the people have a country code and entities have a jurisdiction.
In the chart below we can see the nodes’ types distribution. What stands out is that there is a very small number of intermediaries compared to the number of entitites and officier.
Which countries contribute the most to tax evasion?
A first great way to get insight into the data is to plot on a map the countries with the most outgoing connections.
This is done on the following map : <div> Top 10 countries </div>
It is interactive : to see a specific country, click the button on the top right corner.
As we can see from the map above, some of these countries have already jurisdictions with a low tax rate. This can be explained by the fact that many multinationals have their headquarters in tax havens.
What is our Goal in this Project? (Research Questions)
We chose this project because tax evaders, and inequalities of wealth is a very hot topic right now. We wanted to see how important the problem was, and if we could find some explanations/causes for tax evasion. Indeed a good understanding of that matter could help finding compromises between tax evaders and governments. One regret we have, was we couldn’t find (and didn’t have time to scrap one) a satisfying database for changes in fiscal policies of countries in order to correlate them with offshore account’s creation. Nevertheless we did find some obvious events that we will detail in question I.
Here is the path we followed to answer all the research questions we imagined at the beginning of this project.
I. We start by analyzing the evolution of the number of offshore societies over time.
II. We then try to see if people are the sole owners of their offshore societies or if they share this ownership with others.
III. Next we investigate to how many offshore societies people are connected to.
IV. Afterwards we try to give some meaning to the very odd distribution of the number of intemediaries.
V. Finally we at the correlation between the location of the offshore societies and location of their owners.
I) How does the number of offshore societies evolve over time?
One of the most interesting insights we can get from the Panama Papers data is how the offshore societies evolve over time. In other words, when were most these offshore societies created or deleted?
We start by plotting the number of offshore societies creations per month (left plot) and per year (right plot).
On the left plot we can see that the seasonality of the creation of offshore societies. Of course February is smaller, because it has less days. We can also see that there are less creations in August just as there are fewer business activities during the summer. However it is not as strong as companies’ usual decrease in revenues around this period.
On this plot:
-
We can see a peak in the number of creations of offshore societies between year 1995 and 2000. Our best explanation for this peak is the Dot-com bubble. The Dot-com bubble was a period of extreme economic speculation in the end of the 90s, which generated lots of profits for some trader’s making them eager to transfer those profits through offshore accounts and avoid taxes.
-
We can see another peak between the years 2004 and 2008. Our hypothesis is it was cause by the speculation regarding the real estate market, which caused the 2008 financial crisis. This peak is followed by a sudden decrease, in further graphs we will nevetheless see that it doesn’t imply a decrease in the actual number of accounts.
The left plot shows a peak in the creation of edges around 2008-2009. Our two hypothesis for this difference in the date of offshore company creation and edge creation, are both of them are related to inertia :
- Administrative/human inertia : once an offshore company is created it takes time to connect everyone to it, and/or convince everyone to join the movement
- Economic inertia : once an offshore company is created, it generates more money, and, after some time, makes it possible for it to expand and have more employees/shareholders
The right plot (deletion of connections over the years) is more or less similar to the creation of companies. It can explain that some people quit their original company and joined another, or that the government started paying more attention/track down people having links to offshore societies
We observe a an exponential increase in the number of offshore societies in 2000.
II) Do people share ownership of their offshore society?
It is interesting to investigate whether people are the sole owners of their offshore society or if they share the ownership with others.
Let’s first plot the distribution of offshore societies ownership :
We can see that most of the offshore societies have only one owner. And the number of connections per offshore society decreases exponentially.
Let’s look at this from an other angle. We can divide these values in four categories depending on the number of connections per offshore society.
- Societies that have 1 connection
- Societies that have 2 to 4 connections
- Societies that have 5 to 9 connections
- Societies that have 10 or more connections
These same 4 categories will be used throughout this data story.
Half of the people are only related to one company. Those people are most exclusively officers.
III) To how many offshore societies are people connected to?
Now we are interested in knowing how likely it is for someone that is already connected to an offshore society to be connected to more than one of these offshore societies.
The number of offshore societies per owner can be simply plotted as follows :
We can again divide into the same categories as above to view the data from an other angle. As the great majority of people are connected to only one entity, we add a third plot to focus on people connected to more than one entity.
These distributions show that ownership of a company is a much more privileged relationship. 72.8% of societies are handled by only one person. We will see below that in 91% of the cases this person is an intermediary, meaning everything goes through one person, but there might be many people behind, which we can’t tell.
IV) How does the proportion of intermediaries depend on the category of company (number of connections) ?
Only 1.35% of nodes are intermediaries, yet 21.18% of edges have an intermediary in them. Very few intermediaries play a central role in offshore companies. In the following pie chart we can see the proportion of officers/intermediaries depending on the type of the entity. We kept the same types of entity as in previous analysis : entites with [1] connection, [2-4] connections, [6-9] connections, [10+] connections.
As we can see, even if the company has many connections, they don’t need more intermediaries, and therefore the proportion of intermediary becomes very small for companies with a lot of connections.
Intermediary are essential for an offshore company, it at least need one to communicate with. But having more people in the company doesn’t mean you need more intermediaries to do the work. Intermediaries must therefore have a lot of work when connected to a big company.
This raises one question : if intermediaries are connected to big companies, are they connected to fewer companies in number ? In other words : if you’re an intermediary of a big company do you only take care of this one ?
On average an intermediary is connected to 25.1 entities On average an intermediary that is at least connected to an entity of category :
- [1] is connected to 31.3 entities
- [2-4] is connected to 49.2 entities
- [5-9] is connected to 42.4 entities
- [10+] is connected to 82.0 entities
Note : It might sound weird that each one of these averages are all higher individually than the global average.
But it actually tells us that intermediaries with many connections have clients (entities) in all of the categories ! Indeed those big intermediaries are therefore overrepresented in those means. This also means that the more connections you have as an intermediary, the more diverse they will be.
This is the opposite of what we predicted, the bigger entities you’re an intermediate of, the more entities you are connected to. This probably means that some people or groups of people are notorious intermediaries and are therefore working for many entities, and their experience makes them attractive for bigger companies.
The domination of some huge intermediaries over the other ones can be clearly seen with the following boxplot, where the mean crushes the median.
*Note: 26 intermediaries with more than 2000 connections were removed because otherwise the boxplot becamse even less readable.
V) Correlation between the location of the people and the location of their offshore society?
We are now interested in knowing if there exists a correlation between the location of the people and the location of their offshore society.
Another way to see if there is a correlation between these locations is to directly look at a map. The following link is a map to visualize the distribution of the jurisdictions in which each country detains its account :
There is a pin for each of the 100 biggest countries. It is interactive : to see the distribution of a country, click on it.
Conclusion
We have been able to correlate the evolution in creation and deletion of nodes/edges with some major economic events. Our data exploration showed that offshore accounts are rarely shared between officers, and generally managed by a few people. We understood that intermediaries are very active people, they handle a lot of different entities. Almost all the entities handled by one person are handled by an intermediary that could possibly hide a massive structure. We were not able to find this information, but we have found some of the main actors of the offshore world, and their localisation. There are some obvious hubs for offshore accounts (Virgin Islands, Malta, Bermuda…). Our work will hopefully make you able to explore easily preprocessed useful data yourself in an interactive fashion.


Previous
Next
Previous
Next
Previous
Next
Previous
Next
Previous
Next
Previous
Next
Previous
Next
Previous
Next
Previous
Next
Previous
Next


ANALYSIS: The U.S. National Park Service has nine designated regions. The Alaska region is the only U.S. Park region that is also a state. For many, Alaska may be one of the most remote and untouched land of the U.S. The prestine cool air beckons nature at its best. Alaska's busiest season is during the summer. Of the In 2019, we see the visits (brown line) were more than 700,000 during the months of June, July, and August. Clearly, its the busiest during the month of July. However, as we look at the nearly flat green line, which represents 2020 data, the visits were kept zero (full closure to the public) to 100,000 (highly restrictive opening to visitors).


Phone: {{merchant?.phone}}
pinCode: {{merchant?.pinCode}}
Distance: {{this.convertMiterToKm(merchant?.distance)}} KM


Discussion Board 1
Click me to get answer #1.
Click me to get answer #2.
Click me to get answer #3.
Click me to get answer #4.


Since the early 1920s, just about 20 years after the invention of x-ray, radiology reports mainly exist to support communication between the interpreting radiologist and a referring physician, in a highly technical manner. Following the passage of the Health Information Technology and Clinical Health (HITECH), diagnostic radiology reports are increasingly being made available to patients and their family members. However, these reports are not typically comprehensible to lay recipients, impeding effective communication about report findings.
How can we design tools to improve medical communication about radiology imaging studies for patients and their family members? To answer this question, our research team worked hard over the past year to understand the needs of chronically ill patients and iteratively designed a mobile application to meet their specific needs. In our first attempt to share this tool with a broader audience, we introduce Rapport, an interactive patient-centered radiology report designed to support patient families in reviewing and communicating about radiology studies with their oncologist.
Two studies informed the design of Rapport.
When people have questions that are not addressed in the clinic, they’ll ask them somewhere else. We found many of these questions in online health forums. We began our research by conducting a content analysis of 1600 posts from 4 online health forums to gauge current patients’ information needs related to imaging studies. This analyses informed the design of content structure and types of information to include in the prototype. Next, we sought to understand the range of common concepts embedded in the language used by radiologists who write these reports. To do this, we applied text-processing techniques to identify commonly-occurring phrases (n-grams) from 205,250 unstructured CT and MRI reports, and then validated their meaning with 7 practicing radiologists.
Rapport is able to provide a contextualized selection of report content to associate content fragments with questions and discussion topics. We can present high-resolution 3D illustrations on the fly and give instant access to consumer friendly explanations from trusted medical resources.
Using Apache CTakes, we identifyed relevant clincal text with convoluted concepts. Then, parsing the words based on anatomical relevance using Human Biodigital, we triaged the terms according to defintions that appear in order of most lay-friendly sources (Medlineplus> Wikipedia> Radlex).
Lauren Wilcox Matt Hong Clayton Fuestel Chaitanya Bapta


"x" "1" "MISRA,B AND AMIN,S, SYNTHESIS AND MUTAGENICITY OF TRANS-DIHYDRODIOLMETABOLITES OF BENZO[B]NAPHTHO[2,1-D]THIOPHENE, CHEM. RES. TOXICOL. 3(2):93-97,1990"


I travel frequently for my photography business. Using ImmuTrack has greatly improved my quality of life since I can make sure that I meet all requirements well in advance. No hassle makes for splendid photos!
At ImmuTrack, we know from experience that sometimes it's the little things which make the most difference day-to-day. Read below to see examples of how we've helped other people like you!
I travel frequently for my photography business. Using ImmuTrack has greatly improved my quality of life since I can make sure that I meet all requirements well in advance. No hassle makes for splendid photos!
Thanks to ImmuTrack I no longer worry about the extra burden getting my patient’s records might provide. The process is quick and painless which helps everything go just a little smoother.
As student abroad, ImmuTrack has made things so much easier for me. Now I can focus on what I really want to do instead of on gathering papers.
ImmuTrack saved out wedding plans! A couple of weeks before the wedding, as we were finalizing our honeymoon itinerary we realized that we had to gather the medical documentation necessary for our travel visas. We had no time to spare and thanks to ImmuTrack we were able to make our dreams a reality. Can’t wait to use it with our child soon!
ImmuTrack has taken so much stress out of these first few months. A few weeks before our baby was due I was stressing over how to know when my baby needed shots and which ones they would need. In comes ImmuTrack like a superhero! When I discovered this service I wasn’t sure, but now I can’t imagine trying to handle all of this info without it.
We’ve been using ImmuTrack for just over a year and it has fundamentally changed the way our practice handles vaccinations. By using ImmuTrack we can make sure our customers have all of the information they want ahead of time. And don’t even get me started on moves! Before it was such a hassle trying to make sure patient records were delivered correctly. Now it just takes a few taps and BAM!
I’m so thankful to have access to ImmuTrack. For our first child we didn’t have it and I can’t even begin to explain the difference it has made. Suffice it to day we use it for both of our children and for ourselves.


Careers
Care to join our mission?
We’re always looking for ambitious individuals to help us on our journey. If you’re passionate about our mission to provide clean, accessible transport to improve urban living we want to hear from you!
Why join us?
01
Our tech
We’re using cutting edge technology to drive accessible urban transportation forward. Our fully electric scooters are a joy to ride!
02
Our integrity
We are fully committed to deliver a great yet safe, sustainable micro-mobility experience in every city we serve.
03
Our community
We support every community we serve. All workers are paid a living wage based on their location and are Scoot employees.
General Manager
Jakarta, Indonesia
UI/UX Designer
Yokohama, Japan
Blog Content Copywriter
New York, United States
Graphic Designer
New York, United States
Fleet Supervisor
Jakarta, Indonesia
UX Analyst
London, United Kingdom


Add regular notification Fades out after a certain amount of time, can be set for each notification.
Add sticky notification Doesn't run on a fade timer. Just sits there until the user manually removes it by clicking on the (X).
Add notification without image
Add a white notification has a 'gritter-light' class_name applied to it.
Add notification (with callbacks)
Add a sticky notification (with callbacks)
Add notification with max of 3 If there are 3 messages already on screen, it won't show another one.


HOME
SERVICES
ABOUT BATMAN
WHY BATMAN
MERCHANDISE
Congradulation ! Batman thanking you for buying this product
Product Details
Product quantity
Product name
Product price
Total
Sum
500
Taxes
90
Grand Total
590
Thank YOU!


This is the partial for view 2.
Showing of 'interpolate' filter: {{ 'Current version is v%VERSION%.' | interpolate }}
{{car}} Date format:
(you have to click 3 times to see an alert)


Package : com.danehansen.display Class : public class Preloader Inheritance : Preloader > EventDispatcher > Object
A preloader class designed to easily create a customizable animated canvas preloader. This class depends on TweenLite.js which is available at http://greensock.com/ as well as EventDispatcher.js. It is assumed that it is desired that the canvas element will want to not be shown when the load is full, so either the canvas or the content to be shown after or both will have to have proper positioning added to it so that when the canvas has display:none applied to it that it won’t ruin your layout.
Public Properties
element : Element
[Read-only] Canvas Element that the preloader is to be drawn in.
duration : Number
Duration for the Preloader to make 1 revolution.
Public Methods
Preloader(element:Element, color:uint = "#000", hole:Number = 0, duration:Number = 1)
Creates a Preloader object, using a provided canvas element, color to draw it in, and how big the hole in the center is in relation to the size of the Preloader. The size of the Preloader is the smallest between the width and height of the canvas. The duration is the amount of time, in seconds, for the Preloader to make 1 revolution.
play()
Causes the Preloader to begin looping, at the current duration. This method would be used when the user is waiting for something that would take an undetermined amount of time, such as waiting for a callback. They may see the Preloader animate through just a single time, or many times.
progress(value:Number):*
Gets or sets the instances’s progress. A value of 0 would have the Preloader look empty, 1 would have it look full, and 2 would have it look empty again.
revolve()
Causes the Preloader to make one revolution. This method would be used once the instance’s progress has reached 1, and it is desired for it to make 1 last revolution for it to disappear.
stop()
Causes the Preloader to stop looping at the next occurance that it will not be visible. This method would typically be used after calling the “play” method.
Public Constants
COMPLETE : String = "complete"
[static] The Preloader.COMPLETE constant defines the value of the type property of a complete event object.
Events
complete
Dispatched when the progress has reached a whole number when the instance is not currently playing.
EXAMPLE 1: WAITING FOR A CALLBACK
var autoPreloader=new Preloader(document.getElementById("auto"));
EXAMPLE 2: SHOWING ACTUAL PROGRESS
var progressPreloader=new Preloader(document.getElementById("progress"), "#F0F", 0.25);


This is a jumbotron
adsfadfadfadfadfadf adsfadsfasdfadsfadsf
Hi there
Bootstrap Basics
Click me!
Click me!
Click me!
Bootstrap Docs


{% extends "base.html" %} {% load i18n %} {% block bodyclass %}user_purchases{% endblock %} {% block title %}{% trans "Your purchases" %}{% endblock %} {% block page_title %}{% trans "Your purchases" %}{% endblock %} {% block content %} {% regroup tickets by purchase as purchase_list %} {% for purchase in purchase_list %}
{% trans "We have not yet received your payment. You can find account details on your invoice." %}
{% endif %}
{{ purchase.grouper.first_name }} {{ purchase.grouper.last_name }}
{{ purchase.grouper.street }}
{{ purchase.grouper.zip_code }} {{ purchase.grouper.country }}
{% endif %}
{{ ticket.first_name }} {{ ticket.last_name }}
{% trans "You haven't made any purchases yet." %} {% endfor %} {% endblock %}


Preparation time
less than 30 mins
Cooking time
10 to 30 mins
Serves
Serves 1
Preheat the oven to 200C/400F/Gas 6.
For the garlic butter, place the garlic, olive oil, thyme, salt and freshly ground black pepper onto a small square of aluminium foil and fold up to make a parcel. Place into the oven and roast for 15 minutes, or until the garlic is soft.
Squeeze the garlic flesh from the skins into a bowl with the thyme leaves, softened butter, salt and freshly ground black pepper and mix until well combined.
Fry the pancetta in a frying pan until crisp, then add to the butter and mix well. Shape the butter mixture into a thick log and wrap in baking paper and cling film. Place into the freezer for ten minutes, or until firm. Once firm, cut into thick slices.
For the sirloin, rub the sirloin with the olive oil and season with salt and freshly ground black pepper. Heat a griddle pan until smoking, add the steak and fry for 3-4 minutes on each side (for rare), or until cooked to your liking. Remove the steak from the pan and leave to rest for five minutes on a warm plate.
For the kale, melt the butter in a saucepan, add the garlic and fry for one minute, then add the kale and fry for 2-3 minutes, or until wilted. Season with salt and freshly ground black pepper.
For the garnish, heat a dash of olive oil in a frying pan, season the tomato halves with salt and freshly ground black pepper and then fry for 2-3 minutes, or until just softened.
To serve, pile the kale onto a serving plate and top with the steak. Place a slice of garlic butter on top of the steak and spoon the cherry tomatoes onto the side of the plate.


EU hopes U.S. will rethink choice to pull out of Paris climate pact
by The Associated Press, StaffBRUSSELS -- The European Union has voiced regret at the U.S. government's decision to pull out of the Paris climate agreement and expressed hopes that one of the world's biggest CO2 emitters will backpedal on its decision and rejoin.
European Commission spokeswoman Mina Andreeva said Tuesday that the global deal signed in 2015 remains "the most important international agreement on climate change" and insisted that the EU will continue to "fight global climate change under this legal framework."
Despite the U.S. departure, Andreeva added that the 28-member bloc will continue working with various U.S.-based entities and stakeholders who remain committed to the deal.
"The Paris agreement has strong foundations and is here to stay. Its doors remain open and we hope that the U.S. will decide to pass (them) again one day," Andreeva said.
Germany said the U.S. government's decision is "regrettable" but no surprise.
Environment Minister Svenja Schulze said the U.S. had announced its plan to withdraw from the pact two years ago and "luckily it has remained alone in doing so."
Nearly 200 nations signed the landmark 2015 climate deal to keep global warming below 2 degrees Celsius (3.6 Fahrenheit) by the end of the century, with each country providing its own goals for reducing emissions of greenhouse gases.
Schulze said the "domino effect" some had feared after U.S. President Donald Trump's announcement didn't occur.
"The rest of the world stands together on climate protection," she said in a statement, noting that even Russia, a fossil fuel exporter, recently joined the pact.


--- rel_ver: 0.5.0 layout: release-notes --- 🙌 New Fixed Issue #13. Finished migration to ASF infrastructure. 🤖 Enhancements Fixed Issue #29. Fixed Issue #27. Fixed Issue #28. Fixed Issue #25. 🧐 Fixes Fixed Issue #2. Fixed Issue #4. Fixed Issue #16. Fixed Issue #18. Fixed Issue #19. Fixed Issue #21. Fixed Issue #22. Fixed Issue #24. Fixed Issue #26.
Finished migration to ASF infrastructure.


Cover the Square
问题描述 :
Oh no! The Enterprise is being attacked by a Borg unit cube. We all know that resistance is futile, but that won’t prevent the captain from trying anyway!
The engineers aboard the Enterprise have recently upgraded the size of the ships’s laser beam weapons, such that it can now cut large circular holes into enemy ships. In fact, they can even cut out holes of diameter one, which should get rid of most of the Borg cube in one deadly blow. However, the Borgs are frighteningly persistent, and the captain fears that the remaining undestroyed pieces will cause trouble. Thus, he wants to destroy at least n percent of the cube.
The engineers aboard the Enterprise have recently upgraded the size of the ships’s laser beam weapons, such that it can now cut large circular holes into enemy ships. In fact, they can even cut out holes of diameter one, which should get rid of most of the Borg cube in one deadly blow. However, the Borgs are frighteningly persistent, and the captain fears that the remaining undestroyed pieces will cause trouble. Thus, he wants to destroy at least n percent of the cube.
The Borg cube is positioned such that one of its faces is perpendicular to the enterprise’s line of sight, so the problem is approximately equivalent to trying to cover a unit square with circles of diameter one. Under this approximation and assuming that the undestroyed parts simply remain motionless at their original position, how many shots are required to destroy at least n percent of the cube?
输入:
The first line of the input will contain m, the number of test cases. m lines will follow, each containing an integer n between 0 and 100 inclusively.
输出:
The first line of the input will contain m, the number of test cases. m lines will follow, each containing an integer n between 0 and 100 inclusively.
样例输入:
3 0 50 100
样例输出:
0 1 4
(adsbygoogle = window.adsbygoogle || []).push({});
美国纽约大都会博物馆的藏品吧。
美国纽约大都会博物馆的藏品吧。
美国纽约大都会博物馆的藏品吧。
美国纽约大都会博物馆的藏品吧。
美国纽约大都会博物馆的藏品吧。
美国纽约大都会博物馆的藏品吧。
美国纽约大都会博物馆的藏品吧。
美国纽约大都会博物馆的藏品吧。
美国纽约大都会博物馆的藏品吧。
美国纽约大都会博物馆的藏品吧。
美国纽约大都会博物馆的藏品吧。
终于AC了！next数组还是不好理解啊，mark
好厉害～
不错，再多来的CF上面的题
这种题解就相当于直接贴代码了，，想看的是思路
https://coding.net/moon/miracle
写的很好~~
有意思，有难度
你好，这题给出的代码好像弄错了，这个是pow那道题目的解法
为什么for循环找到的i一定是素数叻，而且约数定理说的是n=p1^a1*p2^a2*p3^a3*…*pk^ak，而你每次取余都用的是原来的m，也就是n
第15行代码，/n/n，应该改为nn
顶一个 赞一个
第二个解法好像不对
https://coding.net/moon/miracle
多谢支持！


Branch ID: {{ data.id }}
City: {{ data.address.city }}
Consignments: {{ data.consignments|count }}
Trucks: {{ data.trucks|count }}
{% extends "auth/layout.html" %}
{% block content %}
Consignments: {{ data.consignments|count }}
Trucks: {{ data.trucks|count }}


XHR/Iframe/JsonP/Script transport api
0.1.7
Url to load or send data to
See ajax.defaults
See ajax.defaults
@access
private
The same set of options you can pass to ajax() and ajax.setup()
Target url
Ajax payload
GET|POST|DELETE|PUT etc
Headers to add to XHR object:
Header-Name: header-value
XHR username
XHR password
html
- along with selector
option treats
response as html, creates a document out of it and
returns selected element.
xml
- parse response as xml and return element(s)
using selector
option
json
parse response as json and return the resulting
object
fragment
- turn response into a DocumentFragment
script
- evaluate response as a script
Abort on timeout
Request content type. Set contentType: json to transform data into json automatically and set header to text/plain.
If contentType = json, set this to specific header you want to send
Key:value pairs to set to xhr object
Make a jsonp request
@default
callback
Name of the parameter with callback
function name: url?
Name of the callback function in global scope
iframe|xhr|script
If files
or form
options are set
and browser doesn't support FormData,
transport will be set to iframe.
When using ajax.load(el, url, opt)
if replace=true, all contents of el will be replaced
by response;
if replace=false, response will be appended.
See dataType
Souce of request data and files, target url and request method
Options passed to ajax()
Current transport object
XHR onprogress callback
XHR.upload progress callback
Either raw or pre-processed response data
ajax's promise
All callback's context
Array of native File objects to send via FormData or iframe
Set default ajax options
See ajax.defaults
Subscribe to global ajax events. See MetaphorJs.lib.Observable.on
Unsubscribe from global ajax events. See MetaphorJs.lib.Observable.un
Same as ajax(), method is forcefully set to GET
Same as ajax(), method is forcefully set to POST
Load response to given html element
Load script
Send form
Utility function that prepares url by adding random seed or jsonp params and does other stuff based on options
See ajax.defaults
Cancel ajax request
Get current transport
@inherited
mixin:MetaphorJs.mixin.Promise
-- called when this promise is resolved; returns new resolve value or promise
-- called when this promise is rejected; returns new reject reason
-- resolve's and reject's functions "this" object
@inherited
mixin:MetaphorJs.mixin.Promise
Add resolve listener
-- function to call when promise is resolved
-- function's "this" object
@inherited
mixin:MetaphorJs.mixin.Promise
Add both resolve and reject listener
-- function to call when promise resolved or rejected
-- function's "this" object
@inherited
mixin:MetaphorJs.mixin.Promise
Add reject listener
-- function to call when promise is rejected.
-- function's "this" object
On successful request
response data
On request error
On request end (success or failure)
On request start
Before sending data
ajax options
Process response data
response data
Current request's promise


Match play. Double Match Point. How should Red play 51?
pips Red=118 White=91
(CorrectAnswer= 0/0, ErrorScore= 0)
Red is running out of time and also playability.
For money 13/12, 13/8 is a reasonable play but at DMP where gammons don’t count and he has to create action now in the hope of taking advantage of his strong home board. Note also, that while the race is bad it is not yet completely lost.
The only realistic play is 24/18. Everything else is a bad error or worse. After 24/18 Red will win a quarter of the time which is the best he can hope for.
For money 13/12, 13/8 is a reasonable play but at DMP where gammons don’t count and he has to create action now in the hope of taking advantage of his strong home board. Note also, that while the race is bad it is not yet completely lost.
The only realistic play is 24/18. Everything else is a bad error or worse. After 24/18 Red will win a quarter of the time which is the best he can hope for.
1. Cubeful 2-ply 24/23 13/8 Eq.: -0.517 0.241 0.029 0.001 - 0.759 0.181 0.007 2. Cubeful 2-ply 24/23 8/3 Eq.: -0.529 (-0.011) 0.236 0.029 0.001 - 0.764 0.209 0.008 3. Cubeful 2-ply 13/12 13/8 Eq.: -0.543 (-0.026) 0.228 0.022 0.001 - 0.772 0.115 0.005 4. Cubeful 2-ply 13/7 Eq.: -0.544 (-0.027) 0.228 0.022 0.001 - 0.772 0.116 0.006 5. Cubeful 2-ply 13/12 8/3 Eq.: -0.547 (-0.030) 0.226 0.020 0.000 - 0.774 0.108 0.006


Vote app Home
My Polls
New Poll
Logout
Welcome
!
You can vote on Poll
. You can select any of the options available below. Please remember that you can vote only once.
Or you can add a new option and vote on it. Please select 'Add a new option' and click Vote.
Submit your vote
Share your votes on Twitter
You can delete your own poll. Click below if you are sure.
Delete


HI !
I'M SHUBHAM
Hello everyone!
I'm Shubham Agarwal. Currently I am an undergraduate student
pursuing my Bachelor of Technology degree in Computer Science
and Engineering, from Birla Institute of Technology, Mesra.
I am a 19 year old coding enthusiast and really into the tech world. I love technology and is very much intrested in programming and in learning how things work on the internet. I am currently a newbie in competitive programming and is keen to learn more.


|
BitShares-Core
6.1.0
BitShares blockchain implementation and command-line interface software
|
#include <api_objects.hpp>
Public Attributes | |
| account_object | account |
| account_statistics_object | statistics |
| string | registrar_name |
| string | referrer_name |
| string | lifetime_referrer_name |
| vector< variant > | votes |
| optional< vesting_balance_object > | cashback_balance |
| vector< account_balance_object > | balances |
| vector< vesting_balance_object > | vesting_balances |
| vector< limit_order_object > | limit_orders |
| vector< call_order_object > | call_orders |
| vector< force_settlement_object > | settle_orders |
| vector< proposal_object > | proposals |
| vector< asset_id_type > | assets |
| vector< withdraw_permission_object > | withdraws_from |
| vector< withdraw_permission_object > | withdraws_to |
| vector< htlc_object > | htlcs_from |
| vector< htlc_object > | htlcs_to |
| more_data | more_data_available |
Definition at line 59 of file api_objects.hpp.
| account_object graphene::app::full_account::account |
Definition at line 61 of file api_objects.hpp.
| vector<asset_id_type> graphene::app::full_account::assets |
Definition at line 74 of file api_objects.hpp.
| vector<account_balance_object> graphene::app::full_account::balances |
Definition at line 68 of file api_objects.hpp.
| vector<call_order_object> graphene::app::full_account::call_orders |
Definition at line 71 of file api_objects.hpp.
| optional<vesting_balance_object> graphene::app::full_account::cashback_balance |
Definition at line 67 of file api_objects.hpp.
| vector<htlc_object> graphene::app::full_account::htlcs_from |
Definition at line 77 of file api_objects.hpp.
| vector<htlc_object> graphene::app::full_account::htlcs_to |
Definition at line 78 of file api_objects.hpp.
| string graphene::app::full_account::lifetime_referrer_name |
Definition at line 65 of file api_objects.hpp.
| vector<limit_order_object> graphene::app::full_account::limit_orders |
Definition at line 70 of file api_objects.hpp.
| more_data graphene::app::full_account::more_data_available |
Definition at line 79 of file api_objects.hpp.
| vector<proposal_object> graphene::app::full_account::proposals |
Definition at line 73 of file api_objects.hpp.
| string graphene::app::full_account::referrer_name |
Definition at line 64 of file api_objects.hpp.
| string graphene::app::full_account::registrar_name |
Definition at line 63 of file api_objects.hpp.
| vector<force_settlement_object> graphene::app::full_account::settle_orders |
Definition at line 72 of file api_objects.hpp.
| account_statistics_object graphene::app::full_account::statistics |
Definition at line 62 of file api_objects.hpp.
| vector<vesting_balance_object> graphene::app::full_account::vesting_balances |
Definition at line 69 of file api_objects.hpp.
| vector<variant> graphene::app::full_account::votes |
Definition at line 66 of file api_objects.hpp.
| vector<withdraw_permission_object> graphene::app::full_account::withdraws_from |
Definition at line 75 of file api_objects.hpp.
| vector<withdraw_permission_object> graphene::app::full_account::withdraws_to |
Definition at line 76 of file api_objects.hpp.


From the Death Certificate of
Mary Ann Staley
Belmont County, Ohio # 21186
PERSONAL INFORMATION
place of death: 747 Burlington Road, Martins Ferry, Belmont
Co., OH
usual residence: 747 Burlington Road, Martins Ferry, Belmont
Co., OH
full name: Mrs. Mary Ann Staley
female, white, widowed
husband: Martin Staley, deceased
birth: June 1, 1860, New Martinsville, W.Va.
age: 85 years 10 months 17 days
father: David Thomas born New Cumberland, W.Va.
mother: Elisabeth Mercer born New Martinsville, W.Va.
informant: George Staley, Martins Ferry, Ohio
burial: 4/22/46; Riverview
funeral
director/embalmer: Wilbur B. Heston,
Martins Ferry, Ohio
MEDICAL CERTIFICATION
date of death: Apr 18, 1946; 6:20 p.m.
physician's statement: I hereby certify that I attended the
deceased from Feby 10, 1946 to
April 18, 1946, that I last saw her alive
March 1946.
cause of death: cardiac failure; duration, 1 day
due to: enlarged heart; duration, years?
______________________*
due to: myocarditis chronic; duration, years?
signature: F.I. Jacoby, M.D.,** 4/20/46, Martins Ferry, Ohio.
Provided by Betty Latta Kitchen
Click here for the Short-Cut Table of Contents


8th Place at the National Championship Tournament, 2006
3rd Place at the National Championship Tournament, 2005
3rd Place at the National Championship Tournament, 2003
3rd Place at the National Championship Tournament, 2002
5th Place at the National Championship Tournament, 2001
7 Regional Championships
10 All-American Awards


Python Code¶
Subpackages¶
Submodules¶
cis_interface.backwards module¶
This module allows for backward compatibility.
-
cis_interface.backwards.
as_str
(s_in, recurse=False, convert_types=None, allow_pass=False)[source]¶ Convert from bytes/unicode/str to a str object.
Parameters: - s_in (str, bytes, unicode) – Object to convert to a str version.
- recurse (bool, optional) – If True, objects that are lists, tuples, or dicts will be recursed into, converting string elements into unicode.
- convert_types (list, optional) – Python types that should be converted to unicode. Defaults to the string types for the current Python version ([str, unicode, bytearray] in Python 2, [bytes, str, bytearray] otherwise).
- allow_pass (bool, optional) – If True and the provided object is not converted, no error will be raised. Defaults to False and objects that cannot be converted will raise an error.
Returns: Str version of input.
Return type: Raises: TypeError
– If supplied type cannot be converted to str.
-
cis_interface.backwards.
as_bytes
(s_in, recurse=False, convert_types=None, allow_pass=False)[source]¶ Convert from bytes/unicode/str to a bytes object.
Parameters: - s_in (str, bytes, unicode) – Object to convert to a bytes version.
- recurse (bool, optional) – If True, objects that are lists, tuples, or dicts will be recursed into, converting string elements into unicode.
- convert_types (list, optional) – Python types that should be converted to unicode. Defaults to the string types for the current Python version ([str, unicode, bytearray] in Python 2, [bytes, str, bytearray] otherwise).
- allow_pass (bool, optional) – If True and the provided object is not converted, no error will be raised. Defaults to False and objects that cannot be converted will raise an error.
Returns: Bytes version of input (str in Python 2, bytes in Python 3).
Return type: bytes/str
Raises: TypeError
– If supplied type cannot be converted to bytes.
-
cis_interface.backwards.
as_unicode
(s_in, recurse=False, convert_types=None, allow_pass=False)[source]¶ Convert from bytes/unicode/str to unicode.
Parameters: - s_in (bytes, unicode, str) – Object to be converted into unicode.
- recurse (bool, optional) – If True, objects that are lists, tuples, or dicts will be recursed into, converting string elements into unicode.
- convert_types (list, optional) – Python types that should be converted to unicode. Defaults to the string types for the current Python version ([str, unicode, bytearray] in Python 2, [bytes, str, bytearray] otherwise).
- allow_pass (bool, optional) – If True and the provided object is not converted, no error will be raised. Defaults to False and objects that cannot be converted will raise an error.
Returns: - Unicode version of input (unicode in Python 2, str in
Python 3).
Return type: unicode/str
Raises: TypeError
– If supplied type cannot be converted to unicode and allow_pass is False.
cis_interface.command_line module¶
-
cis_interface.command_line.
cc_flags
()[source]¶ Get the compiler flags necessary for including the interface library in a C or C++ program.
Returns: The necessary compiler flags and preprocessor definitions. Return type: list
-
cis_interface.command_line.
cistime_comm
()[source]¶ Plot timing statistics comparing the different communication mechanisms.
-
cis_interface.command_line.
cistime_lang
()[source]¶ Plot timing statistics comparing the different languages.
-
cis_interface.command_line.
cistime_os
()[source]¶ Plot timing statistics comparing the different operating systems.
-
cis_interface.command_line.
cistime_py
()[source]¶ Plot timing statistics comparing the different versions of Python.
cis_interface.config module¶
This module imports the configuration for cis_interface.
Todo
Remove reference to environment variables for accessing config options.
-
class
cis_interface.config.
CisConfigParser
(defaults=None, dict_type=<class 'collections.OrderedDict'>, allow_no_value=False, *, delimiters=('=', ':'), comment_prefixes=('#', ';'), inline_comment_prefixes=None, strict=True, empty_lines_in_values=True, default_section='DEFAULT', interpolation=<object object>, converters=<object object>)[source]¶ Bases:
configparser.ConfigParser
Config parser that returns None if option not provided on get.
-
cis_interface.config.
cfg_environment
(env=None, cfg=None)[source]¶ Set environment variables based on config options.
Parameters: - env (dict, optional) – Dictionary of environment variables that should be updated. Defaults to os.environ.
- cfg (
cis_interface.config.CisConfigParser
, optional) – Config parser with options that should be used to update the environment. Defaults tocis_interface.config.cis_cfg
.
-
cis_interface.config.
cfg_logging
(cfg=None)[source]¶ Set logging levels from config options.
Parameters: cfg ( cis_interface.config.CisConfigParser
, optional) – Config parser with options that should be used to update the environment. Defaults tocis_interface.config.cis_cfg
.
-
cis_interface.config.
find_all
(name, path)[source]¶ Find all instances of a file with a given name within the directory tree starting at a given path.
Parameters: Returns: All instances of the specified file.
Return type:
-
cis_interface.config.
locate_file
(fname)[source]¶ Locate a file on PATH.
Parameters: fname (str) – Name of the file that should be located. Returns: - Full path to the located file if it was located, False
- otherwise.
Return type: bool, str
-
cis_interface.config.
update_config
(config_file, config_base=None)[source]¶ Update config options for the current platform.
Parameters:
-
cis_interface.config.
update_config_c
(config)[source]¶ Update config options specific to C/C++.
Parameters: config (CisConfigParser) – Config class that options should be set for. Returns: - Section, option, description tuples for options that could not be
- set.
Return type: list
-
cis_interface.config.
update_config_matlab
(config)[source]¶ Update config options specific to matlab.
Parameters: config (CisConfigParser) – Config class that options should be set for. Returns: - Section, option, description tuples for options that could not be
- set.
Return type: list
-
cis_interface.config.
update_config_windows
(config)[source]¶ Update config options specific to windows.
Parameters: config (CisConfigParser) – Config class that options should be set for. Returns: - Section, option, description tuples for options that could not be
- set.
Return type: list
cis_interface.platform module¶
This module handle platform compatibility issues.
cis_interface.runner module¶
This module provides tools for running models using cis_interface.
-
class
cis_interface.runner.
CisRunner
(modelYmls, namespace, host=None, rank=0, cis_debug_level=None, rmq_debug_level=None, cis_debug_prefix=None)[source]¶ Bases:
cis_interface.tools.CisClass
This class handles the orchestration of starting the model and IO drivers, monitoring their progress, and cleaning up on exit.
Parameters: - modelYmls (list) – List of paths to yaml files specifying the models that should be run.
- namespace (str) – Name that should be used to uniquely identify any RMQ exchange.
- host (str, optional) – Name of the host that the models will be launched from. Defaults to None.
- rank (int, optional) – Rank of this set of models if run in parallel. Defaults to 0.
- cis_debug_level (str, optional) – Level for CiS debug messages. Defaults to environment variable ‘CIS_DEBUG’.
- rmq_debug_level (str, optional) – Level for RabbitMQ debug messages. Defaults to environment variable ‘RMQ_DEBUG’.
- cis_debug_prefix (str, optional) – Prefix for CiS debug messages. Defaults to namespace.
..todo:: namespace, host, and rank do not seem strictly necessary.
-
all_drivers
¶ For all drivers.
Type: iterator
-
closeChannels
(force_stop=False)[source]¶ Stop IO drivers and join the threads.
Parameters: force_stop (bool, optional) – If True, the terminate method is used to stop the drivers. Otherwise, the stop method is used. The stop method will try to exit gracefully while terminate will exit as quickly as possible. Defaults to False.
-
createDriver
(yml)[source]¶ Create a driver instance from the yaml information.
Parameters: yml (yaml) – Yaml object containing driver information. Returns: An instance of the specified driver. Return type: object
-
createInputDriver
(yml)[source]¶ Create an input driver instance from the yaml information.
Parameters: yml (yaml) – Yaml object containing driver information. Returns: An instance of the specified driver. Return type: object
-
createModelDriver
(yml)[source]¶ Create a model driver instance from the yaml information.
Parameters: yml (yaml) – Yaml object containing driver information. Returns: An instance of the specified driver. Return type: object
-
createOutputDriver
(yml)[source]¶ Create an output driver instance from the yaml information.
Parameters: yml (yaml) – Yaml object containing driver information. Returns: An instance of the specified driver. Return type: object
-
do_client_exits
(model)[source]¶ Perform exits for IO drivers associated with a client model.
Parameters: model (dict) – Dictionary of model parameters including any associated IO drivers.
-
do_model_exits
(model)[source]¶ Perform exits for IO drivers associated with a model.
Parameters: model (dict) – Dictionary of model parameters including any associated IO drivers.
-
io_drivers
(model=None)[source]¶ Return the input and output drivers for one or all models.
Parameters: model (str, optional) – Name of a model that I/O drivers should be returned for. Defaults to None and all I/O drivers are returned. Returns: Access to list of I/O drivers. Return type: iterator
-
loadDrivers
()[source]¶ Load all of the necessary drivers, doing the IO drivers first and adding IO driver environmental variables back tot he models.
-
run
(signal_handler=None, timer=None, t0=None)[source]¶ Run all of the models and wait for them to exit.
Parameters: - signal_handler (function, optional) – Function that should be used as a signal handler. Defaults to None and is set by set_signal_handler.
- timer (function, optional) – Function that should be called to get intermediate timing statistics. Defaults to time.time if not provided.
- t0 (float, optional) – Zero point for timing statistics. Is set using the provided timer if not provided.
Returns: Intermediate times from the run.
Return type:
-
cis_interface.runner.
get_runner
(models, **kwargs)[source]¶ Get runner for a set of models, getting run information from the environment.
Parameters: - models (list) – List of yaml files containing information on the models that should be run.
- **kwargs – Additonal keyword arguments are passed to CisRunner.
Returns: Runner for the provided models.
Return type: Raises: Exception
– If config option ‘namespace’ in ‘rmq’ section not set.
cis_interface.scanf module¶
Small scanf implementation.
Python has powerful regular expressions but sometimes they are totally overkill when you just want to parse a simple-formatted string. C programmers use the scanf-function for these tasks (see link below).
This implementation of scanf translates the simple scanf-format into regular expressions. Unlike C you can be sure that there are no buffer overflows possible.
- For more information see
- Original code from:
- http://code.activestate.com/recipes/502213-simple-scanf-implementation/
Modified original to make the %f more robust, as well as added %* modifier to skip fields.
Version: 1.3.3
- Releases:
- 1.0
- 2010-10-11
- Initial release
- 1.1
- 2010-10-13
- Changed regex from ‘match’ (only matches at beginning of line) to ‘search’ (matches anywhere in line)
- Bugfix - ignore cast for skipped fields
- 1.2
- 2013-05-30
- Added ‘collapseWhitespace’ flag (defaults to True) to take the search string and replace all whitespace with regex string to match repeated whitespace. This enables better matching in log files where the data has been formatted for easier reading. These cases have variable amounts of whitespace between the columns, depending on the number of characters in the data itself.
- 1.3
- 2016-01-18
- Add ‘extractdata’ function.
- 1.3.1
- 2016-06-23
- Release to PyPi, now including README.md
- Updates by Meagan Lang:
- 2018-04-12
- Added ability to parse components of field specifiers and cope with whitespace padding.
-
cis_interface.scanf.
scanf
(format, s=None, collapseWhitespace=True)[source]¶ - scanf supports the following formats:
- %c One character %5c 5 characters %d, %i int value %7d, %7i int value with length 7 %f float value %o octal value %X, %x hex value %s string terminated by whitespace
Examples: >>> scanf(“%s - %d errors, %d warnings”, “/usr/sbin/sendmail - 0 errors, 4 warnings”) (‘/usr/sbin/sendmail’, 0, 4) >>> scanf(“%o %x %d”, “0123 0x123 123”) (66, 291, 123)
If the parameter s is a file-like object, s.readline is called. If s is not specified, stdin is assumed.
The function returns a tuple of found values or None if the format does not match.
-
cis_interface.scanf.
scanf_compile
(format, collapseWhitespace=True)[source]¶ Translate the format into a regular expression
For example: >>> format_re, casts = _scanf_compile(‘%s - %d errors, %d warnings’) >>> print format_re.pattern (S+) - ([+-]?d+) errors, ([+-]?d+) warnings
Translated formats are cached for faster reuse
cis_interface.schema module¶
-
class
cis_interface.schema.
ComponentSchema
(schema_type, schema_registry=None, schema_subtypes=None)[source]¶ Bases:
object
Schema information for one component.
Parameters: - schema_type (str) – The name of the component.
- schema_registry (SchemaRegistry, optional) – Registry of schemas that this schema is dependent on.
- **kwargs – Additional keyword arguments are entries in the component schema.
-
classmethod
from_registry
(schema_type, schema_classes, **kwargs)[source]¶ Construct a ComponentSchema from a registry entry.
Parameters: Returns: Schema with information from classes.
Return type:
-
classmethod
from_schema
(schema, schema_registry=None)[source]¶ Construct a ComponentSchema from a schema.
Parameters: schema (dict) – Schema. Returns: Schema with information from schema. Return type: ComponentSchema
-
full_schema
¶ Schema for evaluating YAML input file that fully specifies the properties for each component.
Type: dict
-
class
cis_interface.schema.
SchemaRegistry
(registry=None, required=None)[source]¶ Bases:
object
Registry of schema’s for different integration components.
Parameters: Raises: ValueError
– If registry is provided and one of the required components is missing.-
classmethod
from_file
(fname)[source]¶ Create a SchemaRegistry from a file.
Parameters: fname (str) – Full path to the file the schema should be loaded from.
-
full_schema
¶ Schema for evaluating YAML input file that fully specifies the properties for each component.
Type: dict
-
get_component_keys
(comp_name)[source]¶ Get the properties associated with a certain component.
Parameters: comp_name (str) – Name of the component to return keys for. Returns: All of the valid properties for the specified component. Return type: list
-
get_component_schema
(comp_name)[source]¶ Get the schema for a certain component.
Parameters: comp_name (str) – Name of the component to get the schema for. Returns: Schema for the specified component. Return type: dict
-
is_valid_component
(comp_name, obj)[source]¶ Determine if an object is a valid represenation of a component.
Parameters: Returns: True if the object is valid, False otherwise.
Return type:
-
load
(fname)[source]¶ Load schema from a file.
Parameters: fname (str) – Full path to the file the schema should be loaded from.
-
normalize
(obj, backwards_compat=False, **kwargs)[source]¶ Normalize an object against this schema.
Parameters: - obj (object) – Object to normalize.
- **kwargs – Additional keyword arguments are passed to normalize_instance.
Returns: Normalized object.
Return type:
-
classmethod
register_normalizer
(path)[source]¶ Register a normalizer that will be applied to elements in the instance at the specified path.
Parameters: path (tuple) – Location in schema where normalizer will be applied. Returns: Decorator for registering the normalizer function. Return type: function
-
classmethod
-
cis_interface.schema.
cdriver2commtype
(driver)[source]¶ Convert a connection driver to a file type.
Parameters: driver (str) – The name of the connection driver. Returns: The corresponding file type for the driver. Return type: str
-
cis_interface.schema.
cdriver2filetype
(driver)[source]¶ Convert a connection driver to a file type.
Parameters: driver (str) – The name of the connection driver. Returns: The corresponding file type for the driver. Return type: str
-
cis_interface.schema.
get_schema
(fname=None)[source]¶ Return the cis_interface schema for YAML options.
Parameters: fname (str, optional) – Full path to the file that the schema should be loaded from. If the file dosn’t exist, it is created. Defaults to _schema_fname. Returns: cis_interface YAML options. Return type: dict
-
cis_interface.schema.
inherit_schema
(orig, new_values=None, remove_keys=None, **kwargs)[source]¶ Create an inherited schema, adding new value to accepted ones for dependencies.
Parameters: - orig (dict) – Schema that will be inherited.
- new_values (dict, optional) – Dictionary of new values to add. Defaults to None and is ignored.
- remove_keys (list, optional) – Keys that should be removed form orig before adding the new keys. Defaults to empty list.
- **kwargs – Additional keyword arguments will be added to the schema with dependency on the provided key/value pair.
Returns: New schema.
Return type:
-
cis_interface.schema.
load_schema
(fname=None)[source]¶ Return the cis_interface schema for YAML options.
Parameters: fname (str, optional) – Full path to the file that the schema should be loaded from. If the file dosn’t exist, it is created. Defaults to _schema_fname. Returns: cis_interface YAML options. Return type: dict
-
cis_interface.schema.
migrate_keys
(from_dict, to_dict, key_list)[source]¶ Migrate keys from one component to another that are not in a list of predefined keys.
Parameters:
-
cis_interface.schema.
ordered_dump
(data, stream=None, Dumper=<class 'yaml.dumper.Dumper'>, **kwds)[source]¶
-
cis_interface.schema.
ordered_load
(stream, Loader=<class 'yaml.loader.Loader'>, object_pairs_hook=<class 'collections.OrderedDict'>)[source]¶
-
cis_interface.schema.
register_component
(component_class)[source]¶ Decorator for registering a class as a yaml component.
-
cis_interface.schema.
rwmeth2filetype
(rw_meth)[source]¶ Get the alternate properties that corresponding to the old read_meth/write_meth keywords.
Parameters: rw_meth (str) – Read/write method name. Returns: Property values equivalent to provided read/write method. Return type: dict
-
cis_interface.schema.
standardize
(instance, keys, is_singular=False, suffixes=None, altkeys=None)[source]¶ Standardize a component such that each key contains a list of dictionaries.
Parameters: - instance (dict) – Component to standardize.
- keys (list) – Keys to standardize in the instance.
- is_singular (bool, optional) – If False, the keys are assumed to be plural and singular alternatives are also checked. If True, the keys are assumed to be singular and plural alternatives are also checked. Defaults to False.
- suffixes (list, optional) – Suffixes to add to the keys to get a set of alternate keys that should also be checked. Defaults to None as is ignored.
- altkeys (list, optional) – List of lists of alternate keys. Defaults to None.
cis_interface.timing module¶
-
class
cis_interface.timing.
TimedRun
(lang_src, lang_dst, test_name='timed_pipe', filename=None, comm_type=None, platform=None, python_ver=None, max_errors=5, matlab_running=False, dont_use_perf=False, **kwargs)[source]¶ Bases:
cis_interface.tests.CisTestBase
,cis_interface.tools.CisClass
Class to time sending messages from one language to another.
Parameters: - lang_src (str) – Language that messages should be sent from.
- lang_dst (str) – Language that messages should be sent to.
- test_name (str, optional) – Name of the example. Defaults to ‘timed_pipe’.
- filename (str, optional) – Full path to the file where timing statistics will be saved. This can be a perf json or a Python pickle of run data. Defaults to ‘scalings_{test_name}_{comm_type}.json’ if dont_use_perf is False, otherwise the extension is ‘.dat’.
- comm_type (str, optional) – Name of communication class that should be used for tests. Defaults to the current default comm class.
- platform (str, optional) – Platform that the test should be run on. If the data doesn’t already exist and this doesn’t match the current platform, an error will be raised. Defaults to the current platform.
- python_ver (str, optional) – Version of Python that the test should be run with. If the data doesn’t already exist and this doesn’t match the current version of python, an error will be raised. Defaults to the current version of python.
- max_errors (int, optional) – Maximum number of errors that should be retried. Defaults to 5.
- matlab_running (bool, optional) – If True, the test will assert that there is an existing Matlab engine before starting, otherwise the test will assert that there is not an existing Matlab engine. Defaults to False.
- dont_use_perf (bool, optional) – If True, the timings will be run without using the perf package. Defaults to False.
-
filename
¶ Full path to the file where timing statistics will be saved. This can be a perf json or a Python pickle of run data.
Type: str
-
matlab_running
¶ True if there was a Matlab engine running when the test was created. False otherwise.
Type: bool
-
before_run
(nmsg, msg_size)[source]¶ Actions that should be performed before a run.
Parameters: Returns: Unique identifier for the run.
Return type:
-
can_run
(raise_error=False)[source]¶ Determine if the test can be run from the current platform and python version.
Parameters: raise_error (bool, optional) – If True, an error will be raised if the test cannot be completed from the current platform. Defaults to False. Returns: True if the test can be run, False otherwise. Return type: bool
-
check_output
(fout, nmsg, msg_size)[source]¶ Assert that the output file contains the expected result.
Parameters:
-
classmethod
class_plot
(lang_src='python', lang_dst='python', **kwargs)[source]¶ Create the class for a given combo of languages and comm types, then call plot_scaling_joint.
Parameters: Returns: - Pair of axes containing the
plotted scalings and the fit.
Return type: tuple(matplotlib.Axes, matplotlib.Axes)
-
cleanup_output
(fout)[source]¶ Cleanup the output file.
Parameters: fout (str) – The file to be cleaned up.
-
default_msg_size
¶ Default message sizes for scaling tests. This will vary depending on the comm type so that the maximum size is not more than 10x larger than the maximum message size.
Type: list
-
fit_scaling_count
(msg_size=None, counts=None, **kwargs)[source]¶ Do a linear fit to the scaling of execution time with message count.
Parameters: Returns: The slope and intercept of the linear fit.
Return type:
-
fit_scaling_size
(msg_count=None, sizes=None, **kwargs)[source]¶ Do a linear fit to the scaling of execution time with message count.
Parameters: Returns: The slope and intercept of the linear fit.
Return type:
-
get_entry
(name)[source]¶ Get values for an entry.
Parameters: name (str) – Name of the entry to return.
-
get_yaml_dst
(lang)[source]¶ Get the yaml entry for the destination model.
Parameters: lang (str) – Language for the destination model.
-
get_yaml_src
(lang)[source]¶ Get the yaml entry for the source model.
Parameters: lang (str) – Language for the source model.
-
has_entry
(name)[source]¶ Check to see if there is an entry with the provided name.
Parameters: name (str) – Name of the entry to check for.
-
load
(as_json=False)[source]¶ Load scalings data from a perf BenchmarkSuite json file or a Python pickle.
Parameters: as_json (bool, optional) – If True and self.dont_use_perf is False, the perf BenchmarkSuite data will be loaded as a dictionary from the json. Defaults to False. Returns: - Loaded scalings data. None is returned
- if the file does not exit.
Return type: perf.BenchmarkSuite or dict
-
make_yamlfile
(path)[source]¶ Create a YAML file for running the test.
Parameters: path (str) – Full path to file where the YAML should be saved.
-
output_content
(nmsg, msg_size)[source]¶ Get the result that should be output to file during the run.
Parameters: - nmsg – The number of messages that will be sent.
- msg_sizze – The size of the the messages that will be sent.
Returns: The contents expected in the file.
Return type:
-
plot_scaling
(msg_size, msg_count, axs=None, label=None, xscale=None, yscale='linear', plot_kws={}, time_method='average', per_message=False, **kwargs)[source]¶ Plot scaling of run time with a variable.
Parameters: - msg_size (int, list, np.ndarray) – List of message sizes to use as x variable, or message size to use when plotting dependent on message count.
- msg_count (int, list, np.ndarray) – List of message counts to use as x variable, or message count to use when plotting dependent on message size.
- axs (matplotlib.Axes, optional) – Axes object that line should be added to. If not provided, one is created.
- label (str, optional) – Label that should be used for the line. Defaults to None.
- xscale (str, optional) – ‘log’ or ‘linear’ to indicate what scale the x axis should use. Defaults to ‘linear’.
- yscale (str, optional) – ‘log’ or ‘linear’ to indicate what scale the y axis should use. Defaults to ‘linear’.
- plot_kws (dict, optional) – Ploting keywords that should be passed. Defaults to {}.
- time_method (str, optional) – Timing method that should be used. Valid values include ‘bestof’ and ‘average’. Defaults to ‘average’.
- per_message (bool, optional) – If True, the time per message is returned rather than the total time. Defaults to False.
- **kwargs – Additional keyword arguments are passed to scaling_size or scaling_count.
Returns: Axes containing the plotted scaling.
Return type: matplotlib.Axes
-
plot_scaling_joint
(msg_size0=None, msg_count0=None, msg_size=None, msg_count=None, axs=None, **kwargs)[source]¶ Plot scaling of run time with both count and size, side by side. Anywhere data is exchanged as a tuple for each plot, the plot of scaling with count is first and the scaling with size is second.
Parameters: - msg_size0 (int, optional) – Size of messages to use for count scaling. Defaults to self.base_msg_size.
- msg_count0 (int, optional) – Number of messages to use for size scaling. Defaults to self.base_msg_count.
- msg_size (list, np.ndarray, optional) – List of message sizes to use as x variable on the size scaling plot. Defaults to self.default_msg_size.
- msg_count (list, np.ndarray, optional)) – List of message counts to use as x variable on the count scaling plot. Defaults to self.default_msg_count.
- axs (tuple, optional) – Pair of axes objects that lines should be added to. If not provided, they are created.
- **kwargs – Additional keyword arguments are passed to plot_scaling.
Returns: - Pair of axes containing the
plotted scalings and the fit.
Return type: tuple(matplotlib.Axes, matplotlib.Axes)
-
remove_entry
(name)[source]¶ Remove all runs associated with an entry.
Parameters: name (str) – Name of the entry to be removed.
-
run
(run_uuid, timer=<built-in function time>, t0=None)[source]¶ Run test sending a set of messages between the designated models.
Parameters: Returns: Intermediate times from the run.
Return type:
-
save
(data, overwrite=False)[source]¶ Save scalings data to a new perf BenchmarkSuite json file or a Python pickle. If the file exists and overwrite is not set, an error will be raised. No file is written if data is None.
Parameters: Raises: RuntimeError
– If the file already exists and overwrite is False.
-
scaling_count
(msg_size, counts=None, min_count=1, max_count=100, nsamples=10, scaling='linear', per_message=False, **kwargs)[source]¶ Get scaling of run time with message count.
Parameters: - msg_size (int) – Size of each message that should be sent.
- counts (list, optional) – List of counts to test. Defaults to None and a list is created based on the other keyword arguments.
- min_count (int, optional) – Minimum message count that should be timed. Defaults to 1. This is ignored if ‘counts’ is provided.
- max_count (int, optional) – Maximum message count that should be timed. Defaults to 100. This is ignored if ‘counts’ is provided.
- nsamples (int, optional) – Number of samples that should be done between ‘min_count’ and ‘max_count’. Defaults to 10. This is ignored if ‘counts’ is provided.
- scaling (str, optional) – Scaling for sampling of message counts between ‘min_count’ and ‘max_count’. Defaults to ‘linear’. This is ignored if ‘counts’ is provided.
- per_message (bool, optional) – If True, the time per message is returned rather than the total time. Defaults to False.
- **kwargs – Additional keyword arguments are passed to time_run.
Returns: - Lists of counts timed, minimum execution time, average
execution times, and standard deviations.
Return type:
-
scaling_size
(nmsg, sizes=None, min_size=1, max_size=10000000.0, nsamples=10, scaling='log', per_message=False, **kwargs)[source]¶ Get scaling of run time with message size.
Parameters: - nmsg (int) – Number of messages that should be sent.
- sizes (list, optional) – List of sizes to test. Defaults to None and a list is created based on the other keyword arguments.
- min_size (int, optional) – Minimum message size that should be timed. Defaults to 1. This is ignored if ‘sizes’ is provided.
- max_size (int, optional) – Maximum message size that should be timed. Defaults to 1e7. This is ignored if ‘sizes’ is provided.
- nsamples (int, optional) – Number of samples that should be done between ‘min_size’ and ‘max_size’. Defaults to 10. This is ignored if ‘sizes’ is provided.
- scaling (str, optional) – Scaling for sampling of message sizes between ‘min_size’ and ‘max_size’. Defaults to ‘linear’. This is ignored if ‘sizes’ is provided.
- per_message (bool, optional) – If True, the time per message is returned rather than the total time. Defaults to False.
- **kwargs – Additional keyword arguments are passed to time_run.
Returns: - Lists of sizes timed, minimum execution times, average
execution times, and standard deviations.
Return type:
-
time_per_byte
¶
-
time_run
(nmsg, msg_size, nrep=10, overwrite=False)[source]¶ Time sending a set of messages between the designated models.
Parameters: - nmsg (int) – Number of messages that should be sent.
- msg_size (int) – Size of each message that should be sent.
- nrep (int, optional) – Number of times the test should be repeated to get an average execution time and standard deviation. Defaults to 10.
- overwrite (bool, optional) – If True, any existing entry for this run will be overwritten. Defaults to False.
Returns: - Best of, average and standard deviation in the time (in seconds)
required to execute the program.
Return type:
-
time_run_mine
(nmsg, msg_size, nrep)[source]¶ Time sending a set of messages between the designated models without using the perf package.
Parameters:
-
cis_interface.timing.
get_source
(lang, direction, test_name='timed_pipe')[source]¶ Get the path to the source file.
Parameters: Returns: Full path to the source file.
Return type:
-
cis_interface.timing.
perf_func
(loops, timer, nmsg, msg_size, max_errors)[source]¶ Function to do perf loops over function.
Parameters: - loops (int) – Number of loops to perform.
- timer (TimedRun) – Class with information about the run and methods required for setup/teardown.
- nmsg (int) – Number of messages that should be sent in the test.
- msg_size (int) – Size of messages that should be sent in the test.
- max_errors (int) – Maximum number of errors that should be retried.
Returns: - Time (in seconds) required to perform the test the required
number of times.
Return type:
-
cis_interface.timing.
perfjson_to_pandas
(json_file)[source]¶ Convert perf benchmarks json file to a Pandas data frame.
Parameters: json_file (str) – Full path to the JSON benchmarks file that should be added. Returns: Data frame version of perf benchmarks. Return type: pandas.DataFrame
-
cis_interface.timing.
plot_scalings
(compare='comm_type', compare_values=None, plotfile=None, test_name='timed_pipe', cleanup_plot=False, use_paper_values=False, **kwargs)[source]¶ Plot comparison of scaling for chosen variable.
Parameters: - compare (str, optional) – Name of variable that should be compared. Valid values are ‘language’, ‘comm_type’, ‘platform’, ‘python_ver’. Defaults to ‘comm_type’.
- compare_values (list, optional) – Values that should be plotted. If not provided, the values will be determined based on the current platform.
- plotfile (str, optional) – Full path to the file where the plot will be saved. If not provided, one is created based on the test parameters in the current working directory.
- test_name (str, optional) – Name of the test that should be used. Defaults to ‘timed_pipe’.
- cleanup_plot (bool, optional) – If True, the create plotfile will be removed before the function returns. This is generally only useful for testing. Defaults to False.
- use_paper_values (bool, optional) – If True, use the values from the paper. Defaults to False.
- **kwargs – Additional keyword arguments are passed to plot_scaling_joint.
Returns: Path where the figure was saved.
Return type:
-
cis_interface.timing.
write_perf_script
(script_file, nmsg, msg_size, lang_src, lang_dst, comm_type, nrep=10, max_errors=5, matlab_running=False)[source]¶ Write a script to run perf.
Parameters: - script_file (str) – Full path to the file where the script should be saved.
- nmsg (int) – The number of messages that should be sent during the run.
- msg_size (int) – The size (in bytes) of the test messages that should be sent during the run.
- lang_src (str) – The language that the source program should be in.
- lang_dst (str) – The language that the destination program should be in.
- comm_type (str) – The type of communication channel that should be used for the test.
- nrep (int, optional) – The number of times the test run should be repeated. Defaults to 3.
- max_errors (int, optional) – Maximum number of errors that should be retried. Defaults to 5.
- matlab_running (bool, optional) – If True, the test will assert that there is an existing Matlab engine before starting, otherwise the test will assert that there is not an existing Matlab engine. Defaults to False.
cis_interface.tools module¶
This modules offers various tools.
-
class
cis_interface.tools.
CisClass
(name=None, uuid=None, working_dir=None, timeout=60.0, sleeptime=0.01, **kwargs)[source]¶ Bases:
logging.LoggerAdapter
Base class for CiS classes.
Parameters: - name (str) – Class name.
- uuid (str, optional) – Unique ID for this instance. Defaults to None and is assigned.
- working_dir (str, optional) – Working directory. If not provided, the current working directory is used.
- timeout (float, optional) – Maximum time (in seconds) that should be spent waiting on a process. Defaults to 60.
- sleeptime (float, optional) – Time that class should sleep for when sleep is called. Defaults to 0.01.
- **kwargs – Additional keyword arguments are assigned to the extra_kwargs dictionary.
-
longsleep
¶ Time that the class will sleep for when waiting for longer tasks to complete (10x longer than sleeptime).
Type: float
-
sched_out
¶ Output from the last scheduled task with output.
Type: obj
-
logger
¶ Logger object for this object.
Type: logging.Logger
-
as_str
(obj)[source]¶ Return str version of object if it is not already a string.
Parameters: obj (object) – Object that should be turned into a string. Returns: String version of provided object. Return type: str
-
check_timeout
(key=None, key_level=0)[source]¶ Check timeout for the calling function/method.
Parameters: - key (str, optional) – Key for timeout that should be checked. Defaults to None and is set by the calling class and function/method (See timeout_key).
- key_level (int, optional) – Positive integer indicating the level of the calling class and function/method that should be used to key the timeout. 0 is the class and function/method that called start_timeout. Higher values use classes and function/methods further up in the stack. Defaults to 0.
Raises: KeyError
– If there is not a timeout registered for the specified key.
-
error
¶ Log an error level message.
-
exception
¶ Log an exception level message.
-
get_timeout_key
(key_level=0, key_suffix=None)[source]¶ Return a key for a given level in the stack, relative to the function calling get_timeout_key.
Parameters: - key_level (int, optional) – Positive integer indicating the level of the calling class and function/method that should be used to key the timeout. 0 is the class and function/method that is 2 steps higher in the stack. Higher values use classes and function/methods further up in the stack. Defaults to 0.
- key_suffix (str, optional) – String that should be appended to the end of the generated key. Defaults to None and is ignored.
Returns: Key identifying calling object and method.
Return type:
-
name
Name of the class object.
Type: str
-
periodic_debug
(key, period=10)[source]¶ Log that should occur periodically rather than with every call.
Parameters: Returns: Logging method to be used.
Return type: method
-
pprint
(obj, block_indent=0, indent_str=' ', **kwargs)[source]¶ Use pprint to represent an object as a string.
Parameters: - obj (object) – Python object to represent.
- block_indent (int, optional) – Number of indents that should be placed in front of the entire block. Defaults to 0.
- indent_str (str, optional) – String that should be used to indent. Defaults to 4 spaces.
- **kwargs – Additional keyword arguments are passed to pprint.pformat.
Returns: String representation of object using pprint.
Return type:
-
print_encoded
(msg, *args, **kwargs)[source]¶ Print bytes to stdout, encoding if possible.
Parameters:
-
sched_task
(t, func, args=None, kwargs=None, store_output=False)[source]¶ Schedule a task that will be executed after a certain time has elapsed.
Parameters: - t (float) – Number of seconds that should be waited before task is executed.
- func (object) – Function that should be executed.
- args (list, optional) – Arguments for the provided function. Defaults to [].
- kwargs (dict, optional) – Keyword arguments for the provided function. Defaults to {}.
- store_output (bool, optional) – If True, the output from the scheduled task is stored in self.sched_out. Otherwise, it is not stored. Defaults to False.
-
sleep
(t=None)[source]¶ Have the class sleep for some period of time.
Parameters: t (float, optional) – Time that class should sleep for. If not provided, the attribute ‘sleeptime’ is used.
-
special_debug
¶ Log debug level message contingent of supression flag.
-
start_timeout
(t=None, key=None, key_level=0, key_suffix=None)[source]¶ Start a timeout for the calling function/method.
Parameters: - t (float, optional) – Maximum time that the calling function should wait before timeing out. If not provided, the attribute ‘timeout’ is used.
- key (str, optional) – Key that should be associated with the timeout that is created. Defaults to None and is set by the calling class and function/method (See get_timeout_key).
- key_level (int, optional) – Positive integer indicating the level of the calling class and function/method that should be used to key the timeout. 0 is the class and function/method that called start_timeout. Higher values use classes and function/methods further up in the stack. Defaults to 0.
- key_suffix (str, optional) – String that should be appended to the end of the generated key. Defaults to None and is ignored.
Raises: KeyError
– If the key already exists.
-
stop_timeout
(key=None, key_level=0, key_suffix=None, quiet=False)[source]¶ Stop a timeout for the calling function method.
Parameters: - key (str, optional) – Key for timeout that should be stopped. Defaults to None and is set by the calling class and function/method (See timeout_key).
- key_level (int, optional) – Positive integer indicating the level of the calling class and function/method that should be used to key the timeout. 0 is the class and function/method that called start_timeout. Higher values use classes and function/methods further up in the stack. Defaults to 0.
- key_suffix (str, optional) – String that should be appended to the end of the generated key. Defaults to None and is ignored.
- quiet (bool, optional) – If True, error message on timeout exceeded will be debug log. Defaults to False.
Raises: KeyError
– If there is not a timeout registered for the specified key.
-
class
cis_interface.tools.
CisPopen
(cmd_args, forward_signals=True, **kwargs)[source]¶ Bases:
subprocess.Popen
Uses Popen to open a process without a buffer. If not already set, the keyword arguments ‘bufsize’, ‘stdout’, and ‘stderr’ are set to 0, subprocess.PIPE, and subprocess.STDOUT respectively. This sets the output stream to unbuffered and directs both stdout and stderr to the stdout pipe. In addition this class overrides Popen.kill() to allow processes to be killed with CTRL_BREAK_EVENT on windows.
Parameters: - args (list, str) – Shell command or list of arguments that should be run.
- forward_signals (bool, optional) – If True, flags will be set such that signals received by the spawning process will be forwarded to the child process. If False, the signals will not be forwarded. Defaults to True.
- **kwargs – Additional keywords arguments are passed to Popen.
-
class
cis_interface.tools.
CisThread
(name=None, target=None, args=(), kwargs=None, daemon=False, group=None, **cis_kwargs)[source]¶ Bases:
threading.Thread
,cis_interface.tools.CisClass
Thread for CiS that tracks when the thread is started and joined.
-
lock
¶ Lock for accessing the sockets from multiple threads.
Type: threading.RLock
-
start_event
¶ Event indicating that the thread was started.
Type: threading.Event
-
terminate_event
¶ Event indicating that the thread should be terminated. The target must exit when this is set.
Type: threading.Event
-
terminate
(no_wait=False)[source]¶ Set the terminate event and wait for the thread to stop.
Parameters: no_wait (bool, optional) – If True, terminate will not block until the thread stops. Defaults to False and blocks. Raises: AssertionError
– If no_wait is False and the thread has not stopped after the timeout.
-
-
class
cis_interface.tools.
CisThreadLoop
(*args, **kwargs)[source]¶ Bases:
cis_interface.tools.CisThread
Thread that will run a loop until the terminate event is called.
-
on_main_terminated
(dont_break=False)[source]¶ Actions performed when 1st main terminated.
Parameters: dont_break (bool, optional) – If True, the break flag won’t be set. Defaults to False.
-
-
class
cis_interface.tools.
TimeOut
(max_time, key=None)[source]¶ Bases:
object
Class for checking if a period of time has been elapsed.
Parameters:
-
cis_interface.tools.
eval_kwarg
(x)[source]¶ If x is a string, eval it. Otherwise just return it.
Parameters: x (str, obj) – String to be evaluated as an object or an object. Returns: Result of evaluated string or the input object. Return type: obj
-
cis_interface.tools.
get_CIS_MSG_MAX
(comm_type=None)[source]¶ Get the maximum message size for a given comm type.
Parameters: comm_type (str, optional) – The name of the communication type that the maximum message size should be returned for. Defaults to result of get_default_comm() if not provided. Returns: Maximum message size (in bytes). Return type: int
-
cis_interface.tools.
get_default_comm
()[source]¶ Get the default comm that should be used for message passing.
-
cis_interface.tools.
get_installed_comm
(language=None)[source]¶ Get a list of the communication channel types that are supported by cis_interface on the current machine. This checks the operating system, supporting libraries, and broker credentials. The order indicates the prefered order of use.
Parameters: language (str, optional) – Specific programming language that installed comms should be located for. Defaults to None and all languages supported on the current platform will be checked. Returns: - The names of the the communication channel types supported on
- the current machine.
Return type: list
-
cis_interface.tools.
get_installed_lang
()[source]¶ Get a list of the languages that are supported by cis_interface on the current machine. This checks for the necessary interpreters, licenses, and/or compilers.
Returns: The name of languages supported on the current machine. Return type: list
-
cis_interface.tools.
get_supported_comm
()[source]¶ Get a list of the communication mechanisms supported by cis_interface.
Returns: The names of communication mechanisms supported by cis_interface. Return type: list
-
cis_interface.tools.
get_supported_lang
()[source]¶ Get a list of the model programming languages that are supported by cis_interface.
Returns: The names of programming languages supported by cis_interface. Return type: list
-
cis_interface.tools.
is_comm_installed
(comm, language=None)[source]¶ Check to see if cis_interface can use a communication mechanism on the current machine.
Parameters: Returns: - True if the communication mechanism can be used on the current
machine, False otherwise.
Return type:
-
cis_interface.tools.
is_lang_installed
(lang)[source]¶ Check to see if cis_interface can run models written in a programming language on the current machine.
Parameters: lang (str) – Programming language to check. Returns: - True if models in the provided language can be run on the current
- machine, False otherwise.
Return type: bool
-
cis_interface.tools.
locate_path
(fname, basedir='/')[source]¶ Find the full path to a file using where on Windows.
-
cis_interface.tools.
popen_nobuffer
(*args, **kwargs)[source]¶ Uses Popen to open a process without a buffer. If not already set, the keyword arguments ‘bufsize’, ‘stdout’, and ‘stderr’ are set to 0, subprocess.PIPE, and subprocess.STDOUT respectively. This sets the output stream to unbuffered and directs both stdout and stderr to the stdout pipe.
Parameters: - args (list, str) – Shell command or list of arguments that should be run.
- forward_signals (bool, optional) – If True, flags will be set such that signals received by the spawning process will be forwarded to the child process. If False, the signals will not be forwarded. Defaults to True.
- **kwargs – Additional keywords arguments are passed to Popen.
Returns: Process that was started.
Return type:
cis_interface.units module¶
-
cis_interface.units.
add_units
(arr, unit_str, dtype=None)[source]¶ Add units to an array or scalar.
Parameters: Returns: Array with units.
Return type: unyt.unyt_array
-
cis_interface.units.
are_compatible
(units1, units2)[source]¶ Check if two units are compatible.
Parameters: Returns: True if the units are compatible, False otherwise.
Return type:
-
cis_interface.units.
as_unit
(ustr)[source]¶ Get unit object for the string.
Args:
Returns:
Raises: ValueError
– If the string is not a recognized unit.
-
cis_interface.units.
convert_to
(arr, new_units)[source]¶ Convert qunatity with units to new units. Objects without units will be returned with the new units.
Parameters: Returns: Array with new units.
Return type: unyt.unyt_array
-
cis_interface.units.
get_data
(obj)[source]¶ Get the array/scalar assocaited with the object.
Parameters: obj (object) – Object to get data for. Returns: Numpy array representation of the underlying data. Return type: np.ndarray
-
cis_interface.units.
get_units
(obj)[source]¶ Get the string representation of the units.
Parameters: obj (object) – Object to get units for. Returns: Units, empty if input object has none. Return type: str
-
cis_interface.units.
has_units
(obj)[source]¶ Determine if a Python object has associated units.
Parameters: obj (object) – Object to be tested for units. Returns: True if the object has units, False otherwise. Return type: bool
cis_interface.yamlfile module¶
-
cis_interface.yamlfile.
link_model_io
(existing)[source]¶ Link I/O drivers back to the models they communicate with.
Parameters: existing (dict) – Dictionary of existing components. Returns: Dictionary with I/O drivers added to models. Return type: dict
-
cis_interface.yamlfile.
load_yaml
(fname)[source]¶ Parse a yaml file defining a run.
Parameters: fname (str) – Path to the yaml file. Returns: Contents of yaml file. Return type: dict
-
cis_interface.yamlfile.
parse_component
(yml, ctype, existing=None)[source]¶ Parse a yaml entry for a component, adding it to the list of existing components.
Parameters: Raises: TypeError
– If yml is not a dictionary.ValueError
– If dtype is not ‘input’, ‘output’, ‘model’, or ‘connection’.ValueError
– If the component already exists.
Returns: All components identified.
Return type:
-
cis_interface.yamlfile.
parse_connection
(yml, existing)[source]¶ Parse a yaml entry for a connection between I/O channels.
Parameters: Raises: RuntimeError
– If the ‘inputs’ entry is not a model output or file.RuntimeError
– If neither the ‘inputs’ or ‘outputs’ entries correspond to model I/O channels.
Returns: Updated log of all entries.
Return type:
-
cis_interface.yamlfile.
parse_model
(yml, existing)[source]¶ Parse a yaml entry for a model.
Parameters: Returns: Updated log of all entries.
Return type:
-
cis_interface.yamlfile.
parse_yaml
(files)[source]¶ Parse list of yaml files.
Parameters: files (str, list) – Either the path to a single yaml file or a list of yaml files.
Raises: ValueError
– If the yml dictionary is missing a required keyword or has an invalid value.RuntimeError
– If one of the I/O channels is not initialized with driver information.
Returns: Dictionary of information parsed from the yamls.
Return type:
-
cis_interface.yamlfile.
prep_yaml
(files)[source]¶ Prepare yaml to be parsed by Cerberus using schema including covering backwards compatible options.
Parameters: files (str, list) – Either the path to a single yaml file or a list of yaml files. Returns: YAML ready to be parsed using schema. Return type: dict
Module contents¶
This package provides a framework for integrating models across languages such that they can be run simultaneously, passing input back and forth.