Following our Blog Tutorial example, imagine we wanted to secure access to certain URLs, based on the logged-in user. We also have another requirement: to allow our blog to have multiple authors who can create, edit, and delete their own articles while disallowing other authors from making changes to articles they do not own.
We’re now ready to add our authentication layer. In CakePHP this is handled by
the Cake\Controller\Component\AuthComponent
, a class responsible
for requiring login for certain actions, handling user login and logout, and
also authorizing logged-in users to the actions they are allowed to reach.
To add this component to your application open your src/Controller/AppController.php file and add the following lines:
// src/Controller/AppController.php
namespace App\Controller;
use Cake\Controller\Controller;
use Cake\Event\Event;
class AppController extends Controller
{
//...
public function initialize()
{
$this->loadComponent('Flash');
$this->loadComponent('Auth', [
'loginRedirect' => [
'controller' => 'Articles',
'action' => 'index'
],
'logoutRedirect' => [
'controller' => 'Pages',
'action' => 'display',
'home'
]
]);
}
public function beforeFilter(Event $event)
{
$this->Auth->allow(['index', 'view', 'display']);
}
//...
}
There is not much to configure, as we used the conventions for the users table.
We just set up the URLs that will be loaded after the login and logout actions
is performed, in our case to /articles/
and /
respectively.
What we did in the beforeFilter()
function was to tell the AuthComponent to
not require a login for all index()
and view()
actions, in every
controller. We want our visitors to be able to read and list the entries without
registering in the site.
Now, we need to be able to register new users, save their username and password, and more importantly, hash their password so it is not stored as plain text in our database. Let’s tell the AuthComponent to let un-authenticated users access the users add function and implement the login and logout action:
// src/Controller/UsersController.php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Event\Event;
class UsersController extends AppController
{
// Other methods..
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
// Allow users to register and logout.
// You should not add the "login" action to allow list. Doing so would
// cause problems with normal functioning of AuthComponent.
$this->Auth->allow(['add', 'logout']);
}
public function login()
{
if ($this->request->is('post')) {
$user = $this->Auth->identify();
if ($user) {
$this->Auth->setUser($user);
return $this->redirect($this->Auth->redirectUrl());
}
$this->Flash->error(__('Invalid username or password, try again'));
}
}
public function logout()
{
return $this->redirect($this->Auth->logout());
}
}
Password hashing is not done yet, we need an Entity class for our User in order to handle its own specific logic. Create the src/Model/Entity/User.php entity file and add the following:
// src/Model/Entity/User.php
namespace App\Model\Entity;
use Cake\Auth\DefaultPasswordHasher;
use Cake\ORM\Entity;
class User extends Entity
{
// Make all fields mass assignable except for primary key field "id".
protected $_accessible = [
'*' => true,
'id' => false
];
// ...
protected function _setPassword($password)
{
if (strlen($password) > 0) {
return (new DefaultPasswordHasher)->hash($password);
}
}
// ...
}
Now every time the password property is assigned to the user it will be hashed
using the DefaultPasswordHasher
class. We’re just missing a template view
file for the login function. Open up your src/Template/Users/login.ctp file
and add the following lines:
<!-- File: src/Template/Users/login.ctp -->
<div class="users form">
<?= $this->Flash->render() ?>
<?= $this->Form->create() ?>
<fieldset>
<legend><?= __('Please enter your username and password') ?></legend>
<?= $this->Form->control('username') ?>
<?= $this->Form->control('password') ?>
</fieldset>
<?= $this->Form->button(__('Login')); ?>
<?= $this->Form->end() ?>
</div>
You can now register a new user by accessing the /users/add
URL and log in
with the newly created credentials by going to /users/login
URL. Also, try
to access any other URL that was not explicitly allowed such as
/articles/add
, you will see that the application automatically redirects you
to the login page.
And that’s it! It looks too simple to be true. Let’s go back a bit to explain
what happened. The beforeFilter()
function is telling the AuthComponent to
not require a login for the add()
action in addition to the index()
and
view()
actions that were already allowed in the AppController’s
beforeFilter()
function.
The login()
action calls the $this->Auth->identify()
function in the
AuthComponent, and it works without any further config because we are following
conventions as mentioned earlier. That is, having a Users table with a username
and a password column, and use a form posted to a controller with the user data.
This function returns whether the login was successful or not, and in the case
it succeeds, then we redirect the user to the configured redirection URL that we
used when adding the AuthComponent to our application.
The logout works by just accessing the /users/logout
URL and will redirect
the user to the configured logoutUrl formerly described. This URL is the result
of the AuthComponent::logout()
function on success.
As stated before, we are converting this blog into a multi-user authoring tool, and in order to do this, we need to modify the articles table a bit to add the reference to the Users table:
ALTER TABLE articles ADD COLUMN user_id INT(11);
Also, a small change in the ArticlesController is required to store the currently logged in user as a reference for the created article:
// src/Controller/ArticlesController.php
public function add()
{
$article = $this->Articles->newEntity();
if ($this->request->is('post')) {
$article = $this->Articles->patchEntity($article, $this->request->getData());
// Added this line
$article->user_id = $this->Auth->user('id');
// You could also do the following
//$newData = ['user_id' => $this->Auth->user('id')];
//$article = $this->Articles->patchEntity($article, $newData);
if ($this->Articles->save($article)) {
$this->Flash->success(__('Your article has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('Unable to add your article.'));
}
$this->set('article', $article);
// Just added the categories list to be able to choose
// one category for an article
$categories = $this->Articles->Categories->find('treeList');
$this->set(compact('categories'));
}
The user()
function provided by the component returns any column from the
currently logged in user. We used this method to add the data into the request
info that is saved.
Let’s secure our app to prevent some authors from editing or deleting the others’ articles. Basic rules for our app are that admin users can access every URL, while normal users (the author role) can only access the permitted actions. Again, open the AppController class and add a few more options to the Auth config:
// src/Controller/AppController.php
public function initialize()
{
$this->loadComponent('Flash');
$this->loadComponent('Auth', [
'authorize' => ['Controller'], // Added this line
'loginRedirect' => [
'controller' => 'Articles',
'action' => 'index'
],
'logoutRedirect' => [
'controller' => 'Pages',
'action' => 'display',
'home'
]
]);
}
public function isAuthorized($user)
{
// Admin can access every action
if (isset($user['role']) && $user['role'] === 'admin') {
return true;
}
// Default deny
return false;
}
We just created a simple authorization mechanism. Users with the admin
role will be able to access any URL in the site when logged-in. All other
users – those with the author
role – will have the same access as
users who aren’t logged-in.
This is not exactly what we want. We need to supply more rules to our
isAuthorized()
method. However instead of doing it in AppController,
we’ll delegate supplying those extra rules to each individual controller.
The rules we’re going to add to ArticlesController should permit authors
to create articles but prevent authors from editing articles they do not
own. Add the following content to your ArticlesController.php:
// src/Controller/ArticlesController.php
public function isAuthorized($user)
{
// All registered users can add articles
if ($this->request->getParam('action') === 'add') {
return true;
}
// The owner of an article can edit and delete it
if (in_array($this->request->getParam('action'), ['edit', 'delete'])) {
$articleId = (int)$this->request->getParam('pass.0');
if ($this->Articles->isOwnedBy($articleId, $user['id'])) {
return true;
}
}
return parent::isAuthorized($user);
}
We’re now overriding the AppController’s isAuthorized()
call and internally
checking if the parent class is already authorizing the user. If he isn’t,
then just allow him to access the add action, and conditionally access
edit and delete. One final thing has not been implemented. To tell whether
or not the user is authorized to edit the article, we’re calling a isOwnedBy()
function in the Articles table. Let’s then implement that function:
// src/Model/Table/ArticlesTable.php
public function isOwnedBy($articleId, $userId)
{
return $this->exists(['id' => $articleId, 'user_id' => $userId]);
}
This concludes our simple authentication and authorization tutorial. For securing the UsersController you can follow the same technique we did for ArticlesController. You could also be more creative and code something more general in AppController based on your own rules.
Should you need more control, we suggest you read the complete Auth guide in the Authentication section where you will find more about configuring the component, creating custom Authorization classes, and much more.


# File vendor/plugins/active_scaffold/lib/actions/core.rb, line 25 def accepts?(*types) for priority in request.accepts.compact if priority == Mime::ALL # Because IE always sends */* in the accepts header and we assume # that if you really wanted XML or something else you would say so # explicitly, we will assume */* to only ask for :html return types.include?(:html) elsif types.include?(priority.to_sym) return true end end false end


--- layout: post title: Confirming a Link Click with jQuery categories: JavaScript excerpt: Here's a function I wrote while working on a project that pops up a box confirming whether or not the user is sure the want to go to a link they clicked ---
Here's a function I wrote while working on a project that pops up a box confirming whether or not the user is sure the want to go to a link they clicked, like this.
It may be simple, but I haven't really used javascript's confirm() function much in the past and everything I found only directed the user to a link predefined in the function. I wanted a function that would confirm any link I wanted it to without knowing the link destination in advance, in other words I wanted to confirm dynamic links.
This jQuery function will pop up a confirmation box on any link with the class confirm
and send the user to the destination of that link if they click 'OK'.


Name
Gender Female Male Non-binary Other
Race Black Latinx Asian Indian White Other
Industry Tech Education Finance Health Government Other Sexual Orientation Email
Password
Choose a file to upload:


| t01 |
infection(s), CRP, levels, study, patients, viral, serum, bacterial, protein |
81 |
7 |
| t02 |
COVID-19, severe, lymphocyte, patients, +, cases, mild, 2019, subsets, coronavirus |
41 |
34 |
| t03 |
SARS, platelet, neopterin, patients, mortality, syndrome, illness, platelet_count, acute_respiratory_syndrome, outcome |
24 |
3 |
| t04 |
AUC, curve, sensitivity, specificity, ROC, sepsis, characteristic, receiver, operating, count |
21 |
6 |
| t05 |
proteins, identified, LRG, mass, proteomic, spectrometry, m/z, apolipoprotein, TB, sera |
25 |
1 |
| t06 |
ALT, LDH, AST, aminotransferase, biochemical, activity, lactate_dehydrogenase, pleural, bilirubin, aspartate |
17 |
1 |
| t07 |
dengue, CSF, MS, DF, DHF, MBL, plasma, chemokines, measles, SP‐D |
20 |
0 |
| t08 |
calves, SAA, hp, diarrhea, apps, bovine, renal, serum_amyloid_a, LBP, dogs |
21 |
1 |
| t09 |
expression, gene, FGL2, peripheral, mrna, CPEB4, NPD, PSCC, HNSCC, GI |
15 |
0 |
| t10 |
IL-35, mycetoma, H1N1, IL-37, cytokine(s), IL-6, duration, IL-12, strem-1 |
12 |
1 |
| t11 |
IP-10, bronchiolitis, pg/ml, urinary, UTI, ARI, sputum, exacerbation, children, μg/l |
17 |
0 |
| t12 |
cats, FIP, subjects, feline, NK, .05, cells, APTT, coagulation, fibrin |
13 |
0 |
| t13 |
KD, osteonecrosis, IVIG, ARS, AHSG, CD, coronary, PDMP, IBD, ± |
14 |
0 |
| t14 |
CAP, t-cell, children, mycoplasma, line, sodium, mixed, pneumoniae, landrace, HN |
15 |
3 |
| t15 |
BAL, P<0.001, fluid, MR, RA, mr_score, TBI, bal_fluid, PTX3, HBP |
9 |
0 |


Speed:
Time:
Model
Topology: Grid
Number of nodes:
Initialization duration of nodes:
Duration:
GPS data file (CSV in id,lat,lon,ms)-style.
From:
To:


Arsenal sack Unai Emery after Eintracht Frankfurt Europa League defeat
Unai Emery has been sacked by Arsenal following last night’s shambolic Europa League defeat against Eintracht Frankfurt.
Speaking on behalf of the Arsenal board and our owners Kroenke Sports & Entertainment, Josh Kroenke said: ‘Our most sincere thanks go to Unai and his colleagues who were unrelenting in their efforts to get the club back to competing at the level we all expect and demand.
‘We wish Unai and his team nothing but future success.’
The Spaniard took over from Arsene Wenger in the summer of 2018 and initially impressed, presiding over an impressive 11-game winning run.
Results and performances, however, dipped markedly towards the end of last season, culminating in a failure to secure Champions League qualification and a 4-1 Europa League final defeat against Chelsea.
Emery was backed in the transfer window during the summer with the likes of Nicolas Pepe, David Luiz and Kieran Tierney arriving to bolster a squad which had lost the services of Aaron Ramsey and Laurent Koscielny.
Advertisement Advertisement
The Gunners won their opening two matches of the campaign against Newcastle and Burnley, but a convincing 3-1 defeat at Anfield against Liverpool sparked an alarming run of which has seen Arsenal win just one of their last nine matches in all competitions.
Emery’s side needed only a draw to guarantee to their place in the knockout stage of this season’s Europa League but two second half goals from Daichi Kamada condemned Arsenal to their most embarrassing defeat of an already calamitous season.
The former PSG and Sevilla coach had been given a vote of confidence by the club’s board following the 2-0 defeat against Leicester ahead of the most recent international break, but last night’s farce, played out in front of a half empty Emirates Stadium, proved to be the final straw.
More to follow…


POWER ELECTRONICS VIRTUAL LABORATORY
HALF CONTROLLED RECTIFIER
L1-L2, L4-L5, L6-L7, L7-L8, L9-L10, L10-L11, and L11-L12.


--- layout: post title: "An Either functor" description: "Either forms a normal functor. A placeholder article for object-oriented programmers." date: 2019-01-14 7:27 UTC tags: [Software Design] --- {% include JB/setup %}
{{ page.description }}
This article is an instalment in an article series about functors. As another article explains, Either is a bifunctor. This makes it trivially a functor. As such, this article is mostly a place-holder to fit the spot in the functor table of contents, thereby indicating that Either is a functor.
Since Either is a bifunctor, it's actually not one, but two, functors. Many languages, C# included, are best equipped to deal with unambiguous functors. This is also true in Haskell, where Either l r
is only a Functor
over the right side. Likewise, in C#, you can make IEither<L, R>
a functor by implementing Select
:
public static IEither<L, R1> Select<L, R, R1>( this IEither<L, R> source, Func<R, R1> selector) { return source.SelectRight(selector); }
This method simply delegates all implementation to the SelectRight
method; it's just SelectRight
by another name. It obeys the functor laws, since these are just specializations of the bifunctor laws, and we know that Either is a proper bifunctor.
It would have been technically possible to instead implement a Select
method by calling SelectLeft
, but it seems generally more useful to enable syntactic sugar for mapping over 'happy path' scenarios. This enables you to write projections over operations that can fail.
Here's some C# Interactive examples that use the FindWinner
helper method from the Church-encoded Either article. Imagine that you're collecting votes; you're trying to pick the highest-voted integer, but in reality, you're only interested in seeing if the number is positive or not. Since FindWinner
returns IEither<VoteError, T>
, and this type is a functor, you can project the right result, while any left result short-circuits the query. First, here's a successful query:
> from i in FindWinner(1, 2, -3, -1, 2, -1, -1) select i > 0 Right<VoteError, bool>(false)
This query succeeds, resulting in a Right
object. The contained value is false
because the winner of the vote is -1
, which isn't a positive number.
On the other hand, the following query fails because of a tie.
> from i in FindWinner(1, 2, -3, -1, 2, -1) select i > 0 Left<VoteError, bool>(Tie)
Because the result is tied on -1
, the return value is a Left
object containing the VoteError
value Tie
.
Another source of error is an empty input collection:
> from i in FindWinner<int>() select i > 0 Left<VoteError, bool>(Empty)
This time, the Left
object contains the Empty
error value, since no winner can be found from an empty collection.
While the Select
method doesn't implement any behaviour that SelectRight
doesn't already afford, it enables you to use C# query syntax, as demonstrated by the above examples.
Next: A Tree functor.


Measuring the Center of a Distribution
When we look at a distribution, we often can get an intuitive sense of where its “center” is. But what do we really mean by the term “center?” The notion of center often allows us to think about the value we expect a typical or “average” observation to have, but there are multiple ways of defining this center. In statistics, three different measures of center are used: the mean, median, and mode.
The mean
The mean is the measure most frequently referred to as the “average” although that term could apply to the median and mode as well. The mean is the balancing point of a distribution. Imagine trying to balance a distribution on your finger like a basketball. Where along the distribution would you place your finger to achieve this balance? This point is the mean. It is equivalent to the concept of “center of mass” from physics.
The calculation of the mean is straightforward:
- Sum up all the values of your variable across all observations.
- Divide this sum by the number of observations.
As an example, lets take a sub-sample of our movie data. I am going to select all the romances (not including rom-coms which are coded as comedies) produced in 2013. There were nine “pure” romances in 2013. I want to know their mean Tomato Meter rating.
| Title | Tomato Meter |
|---|---|
| Kill Your Darlings | 77 |
| I’m in Love with a Church Girl | 6 |
| Safe Haven | 12 |
| The Face of Love | 43 |
| Love and Honor | 13 |
| Before Midnight | 98 |
| Drinking Buddies | 83 |
| Ain’t Them Bodies Saints | 79 |
| The Great Gatsby | 49 |
| Sum | 460 |
In the very last row, I show the sum of the Tomato Meter rating which simply sums up the Tomato Meter rating of each movie. To calculate the mean, I simply divide this sum by the number of movies which is 9.
\[\bar{x}=\frac{460}{9}=51.11\]
The mean Tomato Meter rating for romantic movies in 2013 was 51.11. Notice the funny \(x\) with a bar over it (“x bar”). Mathematically, we often represent variables with lower-case roman letters like \(x\) or \(y\). Putting the bar above the letter is the way to mathematically signify the mean of that variable.
Since we are discussing math symbols, lets talk about creating a mathematical formula for what we just did. In order to do that, I need to introduce a variety of mathematical symbols, but don’t get frightened. We are just formalizing the method of calculating the mean that I just demonstrated above.
First, as I said we represent a given variable by a lower-case roman letter, such as \(x\). If we want to specify a particular observation of \(x\), we use a subscript number. So \(x_1\) is the value of the first observation of \(x\) in our data and \(x_{25}\) is the value of the 25th observation of \(x\) in our data. We use the letter n to signify the number of observations so \(x_n\) is always the last observation of \(x\) in our data.
Now we need some way to indicate “sum up all the values of \(x\).” This is given by the summation sign which looks as follows:
\[\sum_{i=1}^n x_i\]
In English, this just means “sum up all the values of \(x\), starting at \(x_1\) and ending at \(x_n\).” That gives us our sum, which we just need to divide by the number of observations, \(n\).
\[\bar{x}=\frac{\sum_{i=1}^n x_i}{n}\]
In R, the mean is very straightforward to calculate. Lets calculate the mean of the Tomato Meter rating for all movies in our dataset:
## [1] 47.77595
The sum
command calculates the sum and the nrow
command calculates the number of rows of our dataset, which is equivalent to the number of observations. Or we could go even simpler and just use the mean
command:
## [1] 47.77595
We can see that the mean Tomato Meter of romantic movies in 2013 (51.1) were slightly above the mean for all the movies in our dataset (47.8), but not by much.
One last thing to note is that it only makes sense to calculate the mean of quantitative variables. You cannot add up the values for categorical variables because categorical values don’t have numeric values. Rather, they have categories. Notice that you will get an “NA” value and a warning if you try to do this using the mean
command:
## Warning in mean.default(movies$Rating): argument is not numeric or logical:
## returning NA
## [1] NA
The median
The median is almost as widely used as the mean as a measure of center, for reasons I will discuss below. The median is the midpoint of the distribution. It is the point at which 50% of observations have lower values and 50% of the observations have higher values.
In order to calculate the median, we need to first order our observations from lowest to highest. Lets do that with the romantic movie data above.
| Title | Tomato Meter | Order |
|---|---|---|
| I’m in Love with a Church Girl | 6 | 1 |
| Safe Haven | 12 | 2 |
| Love and Honor | 13 | 3 |
| The Face of Love | 43 | 4 |
| The Great Gatsby | 49 | 5 |
| Kill Your Darlings | 77 | 6 |
| Ain’t Them Bodies Saints | 79 | 7 |
| Drinking Buddies | 83 | 8 |
| Before Midnight | 98 | 9 |
To find the median, we have to find the observation right in the middle. When we have an odd number of observations, finding the exact middle is easy. In this case, it is given by the 5th observation because it has four observations lower than it and four observations higher than it. So the median Tomato Meter rating for romantic movies in 2013 was 49.
When you have an even number of observations, then finding the median is slightly more tricky because you have no single observation that is exactly in the middle. In this case, you find the two observations that are closest to the middle and calculate their mean (sum them up and divide by two). For example, if we had ten observations, we would take the mean of the 5th and 6th observations to calculate the median.
The median
command in R will calculate the median for you.
## [1] 47
In this particular case, the mean (47.8) and median (47) of the Tomato Meter produced very similar measures of center, but this isn’t always the case as I will demonstrate below.
As for the mean, it makes no sense to calculate the median of a categorical variable.
The mode
The mode is the least used of the three measures of center. In fact, it is so infrequently used that R does not even have a built-in function to calculate it. The mode is the high point or peak of the distribution. When you look at a distribution graphically, the mode is what your eye is drawn to as a measure of center. Calculating the mode however is much trickier. Simply speaking, the mode is the most common value in the data. However, when data are recorded down to very precise decimal levels, this can be a misleading number. Furthermore, there may be multiple “peaks” in the data and so speaking of a single mode can be misleading. In the sample of 2013 romance movies, no value was repeated and so there is no legitimate value for the mode.
In the case of the tomato meter distribution for the movies dataset, we have a tie for the most common value. 41 movies had Tomato Meter ratings of 29, 33, and 51, respectively. Figure 10 shows that the distribution of tomato meter ratings lacks any real peak, with a relatively even distribution across most values.
ggplot(movies, aes(x=TomatoMeter))+
geom_histogram(binwidth=5, col="black", fill="grey")+
labs(x="age")+
geom_vline(xintercept = c(29,33,51), size=2, color="red")+
theme_bw()
Interestingly, while it does not make sense to think about a mean or a median for quantitative variables, we can use the idea of the mode for categorical variables. The most common category is often referred to as the modal category. If you want to quickly identify the modal category for a categorical variable, you can wrap a table
command inside a sort
command with the decreasing=TRUE
argument to see the top category at the right.
##
## R PG-13 PG G
## 1143 991 363 56
R-Rated movies are the modal category for maturity rating in our movies dataset.
Comparing the mean and median
How can the mean and median give different results? Remember that the mean defines the balancing point and the median defines the midpoint. If you have a perfectly symmetric distribution, then these two points are the same because you would balance the distribution at the midpoint. However, when the distribution is skewed in one direction or another, the mean and the median will be different. In order to maintain balance, the mean will be pulled in the direction of the skew. When you have heavily skewed distributions, this can lead to dramatically different values for the mean and median.
Lets look at this phenomenon for a couple of variables in the movie dataset. As the histogram above showed, the Tomato Meter variable is fairly symmetric and as a result we end up with a mean (47.8) and median (47) that are pretty close. Figure 11 shows the distribution of movie runtime which is somewhat more right-skewed.
The skew here is not too dramatic, but it pulls the mean about 3 minutes higher than the median.
Figure 12 shows the distribution of box office returns to movies which is heavily right skewed. Most movies make moderate amounts of money, and then there are a few star performers that make bucket loads of cash.
As a result of this skew, the mean box office returns are about $45.2 million, while the median box office returns are about $21.6 million. The mean here is more than double the median!
Note that neither estimate is in some fundamental way incorrect. They are both correctly estimating what they were intended to estimate. It is up to us to understand and interpret these numbers correctly and to understand their limitations.
In many cases, we are actually more interested in the median as a measure of “average” experience than the mean, even though we think of the mean as the “average.” This is, for example, why you see home prices in an area always reported in terms of medians rather than means. Mean home prices tend to be much higher than median home prices because of the relatively few very expensive homes in a given area.


Implementation
Technical implementation will take place, for example, through the use of Bitcoin as a medium of exchange and Bitcoin Smart Contracts through Rootstock (RSK), with a parallel individual DAO and Blockchain through Scala, with Scorex as a framework. At the moment we are also examining the use of Bitnation/Pangea. For programming enthusiasts, this opens up a large field of opportunities and also beliefs.
In just 6 months, the blockchain landscape will already have changed drastically and further developed. Furthermore, we only expect the project to start with the first participants in 1-2 years, followed by a 1-2 year experiment phase, probably with a few adjustments through the experiences gained.
For this reason, we are working on a largely centralized prototype for the experiment phase.
Our focus lies in the network consisting of people, the dynamics which are developed therein and in which form and under which rules the goal of mutual coverage for emergencies can be achieved most reasonably.
All software we develop will be published at no cost as an open source.


Time Complexity
Let's look at a simple implementation of linear search:
var doLinearSearch = function(array, targetValue) {
for (var guess = 0; guess < array.length; guess++) {
if (array[guess] === targetValue) {
return guess; // found it!
}
}
return -1; // didn't find it
};
Let's denote the size of the array (array.length) by n nn. The maximum number of times that the for-loop can run is n nn, and this worst case occurs when the value being searched for is not present in the array.
Each time the for-loop iterates, it has to do several things:
Each of these little computations takes a constant amount of time each time it executes. If the for-loop iterates n times, then the time for all n iterations is c1*n, where c1 is the sum of the times for the computations in one loop iteration. Now, we cannot say here what the value of c1 is, because it depends on the speed of the computer, the programming language used, the compiler or interpreter that translates the source program into runnable code, and other factors.
This code has a little bit of extra overhead, for setting up the for-loop (including initializing guess to 0) and possibly returning -1 at the end. Let's call the time for this overhead c2, which is also a constant. Therefore, the total time for linear search in the worst case is c1*n + c2
As we've argued, the constant factor c1 and the low-order term c2 don't tell us about the rate of growth of the running time. What's significant is that the worst-case running time of linear search grows like the array size n. The notation we use for this running time is Θ(n) . That's the Greek letter "theta," and we say "big-Theta of n" or just "Theta of n."
When we say that a particular running time is Θ(n), we're saying that once n gets large enough, the running time is at least k1*n and at most k2*n for some constants k1 and k2. Here's how to think of Θ(n):
For small values of n nn, we don't care how the running time compares with k1*n or k2*n. But once n gets large enough—on or to the right of the dashed line the running time must be sandwiched between k1*n and k2*n.As long as these constants k1 and k2 exist, we say that the running time is Θ(n).
We are not restricted to just n in big-Θ notation. We can use any function, such as n 2 , nlog 2 n, or any other function of n. Here's how to think of a running time that is Θ(f(n)) for some funtion f(n).
Once n gets large enough, the running time is between k1*f(n) and k2*f(n)
In practice, we just drop constant factors and low-order terms. Another advantage of using big-Θ notation is that we don't have to worry about which time units we're using. For example, suppose that you calculate that a running time is 6n 2 + 100n + 300 microseconds. Or maybe it's milliseconds. When you use big-Θ notation, you don't say. You also drop the factor 6 and the low-order terms 100n + 300 and you just say that the running time is Θ(n 2 ).
When we use big-Θ notation, we're saying that we have an asymptotically tight bound on the running time. "Asymptotically" because it matters for only large values of n."Tight bound" because we've nailed the running time to within a constant factor above and below.
We use big-Θ notation to asymptotically bound the growth of a running time to within constant factors above and below. Sometimes we want to bound from only above.
For example, although the worst-case running time of binary search is
Θ(log2n), it would be incorrect to say that binary search runs in Θ(log2n) time in all cases. What if we find the target value upon the first guess? Then it runs in Θ(1) time.The running time of binary search is never worse than
Θ(log2n) but it's sometimes better.
It would be convenient to have a form of asymptotic notation that means "the running time grows at most this much, but it could grow more slowly." We use "big-O" notation for just such occasions.
If a running time is O(f(n)), then for large enough n , the running time is at most k*f(n) for some constant k. Here's how to think of a running time that is O(f(n)).
We say that the running time is "big-O of f(n)" or just "O of f(n)". We use big-O notation for asymptotic upper bounds, since it bounds the growth of the running time from above for large enough input sizes.
Now we have a way to characterize the running time of binary search in all cases. We can say that the running time of binary search is always O(log2n). We can make a stronger statement about the worst-case running time: it's Θ(log2n). But for a blanket statement that covers all cases, the strongest statement we can make is that binary search runs in O(log2n) time.
If you go back to the definition of big-Θ notation, you'll notice that it looks a lot like big-O notation, except that big-Θ notation bounds the running time from both above and below, rather than just from above. If we say that a running time is Θ(f(n)) in a particular situation, then it's also O(f(n)). For example, we can say that because the worst-case running time of binary search is Θ(f(n)), it is also O(f(n)).
The converse is not necessarily true: as we've seen, we can say that binary search always runs in Θ(log2n) time but not that it always runs in O(log2n) time.
Because big-O notation gives only an asymptotic upper bound, and not an asymptotically tight bound, we can make statements that at first glance seem incorrect, but are technically correct. For example, it is absolutely correct to say that binary search runs in O(n) time. That's because the running time grows no faster than a constant times n. In fact, it grows slower.
Think of it this way. Suppose you have 10 dollars in your pocket. You go up to your friend and say, "I have an amount of money in my pocket, and I guarantee that it's no more than one million dollars." Your statement is absolutely true, though not terribly precise.
One million dollars is an upper bound on 10 dollars, just as O(n) is an upper bound on the running time of binary search. Other, imprecise, upper bounds on binary search would be O(n2), O(n3) and O(2n). But none of Θ(n), Θ(n2), Θ(n3) ans Θ(2n) would be correct to describe the running time of binary search in any case.
Sometimes, we want to say that an algorithm takes at least a certain amount of time, without providing an upper bound. We use big-Ω notation; that's the Greek letter "omega."
If a running time is Ω(f(n)), then for large enough n, the running time is at least k*f(n) for some constant k. Here's how to think of a running time that is Ω(f(n)).
We say that the running time is "big-Ω of f(n)" We use big-Ω notation for asymptotic lower bounds, since it bounds the growth of the running time from below for large enough input sizes.
Just as Θ(f(n)) automatically implies O(f(n)) it also automatically implies Ω(f(n)).So we can say that the worst-case running time of binary search is Ω(log2n)
We can also make correct, but imprecise, statements using big-Ω notation. For example, if you really do have a million dollars in your pocket, you can truthfully say "I have an amount of money in my pocket, and it's at least 10 dollars." That is correct, but certainly not very precise. Similarly, we can correctly but imprecisely say that the worst-case running time of binary search is Ω(1), because we know that it takes at least constant time.
Of course, typically, when we are talking about algorithms, we try to describe their running time as precisely as possible. We provide the examples of the imprecise statements here to help you better understand big-Ω, big-O and
big-Θ.


{% extends "layout.html" %} {% block page_title %} Personal details {% endblock %} {% block content %} {% include "../includes/phase_banner_alpha.html" %} Back Personal details Title First name Middle name(s) Last name Date of birth DD MM YYYY Day Month Year Are you male or female? Male Female National Insurance number {% include "../includes/help.html" %} {% endblock %} {% block body_end %} {% include "includes/scripts.html" %} {% endblock %}
DD MM YYYY


| Name | Definition |
| WoundAbsenceAssertion | Documents the absence of a wound at a given body site. No wounds anywhere on the body can be indicated by omitting the anatomical location, or using the Snomed code #181469002 (Entire skin (body structure)) in WoundAnatomicalLocation. |
| WoundAssessmentPanel | Group of observations regarding the properties and severity of a wound. |
| WoundBedAppearanceObservation | The appearance of the base (bed) of the wound, together with the percentage of the bed with each type of appearance. |
| WoundBedColorObservation | Color of part or all of the wound base (bed), and the percentage of the area with that color. |
| WoundEdgeObservation | The state of the tissue at the edge of the wound. |
| WoundExudateObservation | Description of the fluid produced by a wound. |
| WoundPresenceAssertion | A determination that a wound that exists at a particular body site. The WoundIdentifier serves as a link between this assertion and assessments of the wound that might occur at later times. Multiple wound assessments can be associated with a single wound. |
| WoundSizeObservation | The estimated or measured dimensions of a wound. |
| WoundTunnelingObservation | A discharging blind-ended track that extends from the surface of an organ to an underlying area or abscess cavity. The track is invariably lined with granulation tissue. In chronic cases this may be augmented with epithelial tissue. |
| WoundUnderminingObservation | Assessment of deep tissue (subcutaneous fat and muscle) damage around the wound margin. Undermining are narrow sinus tracts away from the wound margins and go downward into the wound. |
| Name | Definition |
| Abatement | The end, remission or resolution. |
| AccessionIdentifier | Identifier assigned by the lab |
| ActiveFlagAsaCodeableConcept | If the ActiveFlag is false, it indicates the record or item is no longer to be used and should generally be hidden for the user in the UI. |
| ActiveFlag | If the ActiveFlag is false, it indicates the record or item is no longer to be used and should generally be hidden for the user in the UI. |
| Actual | True if the group is an actual group (as opposed to definitional). |
| AdditionalText | A text note containing additional details, explanation, description, comment, or summarization. Details can discuss, support, explain changes to, or dispute information. |
| Additive | Additive associated with container. |
| AddressLine | Part of an address that contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information. (Source: HL7 FHIR). |
| Address | An address expressed using postal conventions (as opposed to GPS or other location definition formats). This data type may be used to convey addresses for use in delivering mail as well as for visiting locations and which might not be valid for mail delivery. There are a variety of postal address formats defined around the world. (Source: HL7 FHIR). |
| AdministrativeGender | A gender classification used for administrative purposes. Administrative gender is not necessarily the same as a biological description or a gender identity. This attribute does not include terms related to clinical gender. |
| Age | How long someone has been alive, or something has existed. |
| AnatomicalDirection | Anatomical location or specimen further detailing directionality. |
| AnatomicalLocation | A location or structure in the body, including tissues, regions, cavities, and spaces; for example, right elbow, or left ventricle of the heart. |
| ApplicableAgeRange | The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so. |
| ApplicableSubpopulation | Codes to indicate the target population this reference range applies to. For example, a reference range may be based on the normal population or a particular sex or race. |
| AssertionAbsenceStatement | Statement that a finding is absent. |
| AssertionPresenceStatement | Statement that a finding is present. |
| AssertionStatement | A clinical statement that asserts presence or absence. |
| Attribution | Information ascribing the record to a particular contributor or responsible person. |
| BinaryData | The data itself. |
| Brand | If the product is branded, and if so, the brand name of a product. |
| BrandName | The marketing name for a brand name product |
| Capacity | Container volume or size. |
| Category | The type, kind, or class of this item. |
| Certainty | The degree of confidence in a conclusion or assertion. |
| City | The name of a municipality, city, town, village or other community or delivery center. (Source: HL7 FHIR). |
| ClinicalNote | An entry concerning a patient where the result is a narrative text. |
| ClinicalStatement | A special type of information entry consisting of a topic and a context. The ClinicalStatement class provides the core pattern for more specific clinical statement classes, such as a statement that a finding has been found in a patient or that a procedure has been proposed by a clinical decision support system. The ClinicalStatement pattern defines the core attributes common to most clinical statements and specifies a composition pattern that encourage model component reuse and better alignment with the SNOMED CT Concept Model. |
| ClinicalStatus | A flag indicating whether the condition is active or inactive, recurring, in remission, or resolved (as of the last update of the Condition). |
| CodeSystem | A formal terminology system. |
| CodeSystemVersion | The version of the vocabulary being used, if applicable. |
| CodedEvaluationComponent | An evaluation component whose value is a code (concept). |
| CollectionMethod | How the specimen was obtained. |
| CollectionSite | The body site where specimen was collected |
| CollectionSource | The person or thing the sample was obtained from. |
| CollectionTime | When the sample was obtained, as a specific time or time period. |
| Comparator | |
| ComponentOnlyNonLaboratoryObservation | An observation with components, but without a result value or panel members. |
| ConditionAbsenceStatement | A finding that a condition is or was not present in the subject at a certain time, not necessarily the time the information is gathered. |
| ConditionCause | The cause of the condition. This includes such causes as disease vectors and endogenous states (e.g., macular degeneration due to diabetes), substances, medications, micro-organisms, and forces associated with the occurrence of a Condition from temporal or causative perspectives |
| ConditionIdentifier | A human-readable identifier for the condition at the finding site, for example, a wound number or tumor identifier. |
| ConditionPresenceStatement | A condition that is or may be present in a subject. ‘Condition’ is interpreted broadly and could be a disorder, abnormality, problem, injury, complaint, functionality, illness, disease, ailment, sickness, affliction, upset, difficulty, disorder, symptom, worry, or trouble. |
| ContactPoint | An electronic means of contacting an organization or individual. |
| Content | Abstract ancestor of all concrete content types. A unit of content that makes up a composition - e.g., a clinical statement in a patient record, a simple or composite action is a knowledge document, a catalog entry in a catalog. |
| ContentType | Mime type of the content, with charset etc. |
| ContextCode | Code representing the sense in which the statement is interpreted, for example, the degree of presence in a PresenceStatement. |
| Count | The number of items (0 or more), as an integer. |
| Country | Country - a nation as commonly understood or generally accepted, expressed in ISO 3166 Alpha-2 (2-letter) codes. |
| CreationTime | The point in time when the information was recorded in the system of record. |
| Criticality | The potential clinical harm associated with a condition. When the worst case result is assessed to have a life-threatening or organ system threatening potential, it is considered to be of high criticality. |
| DateOfBirth | A date of birth or approximate year or period (year or date range), if estimated. |
| DeltaFlag | Indicator of significant change (delta) from the last or previous measurement. |
| Denominator | The divisor of a fraction. |
| Device | A specific durable physical device used in diagnosis or treatment. The value is the coding for a type of device, for example, a CPAP machine. The same device might be used on multiple patients. |
| DeviceUdi | Unique Device Identifier (UDI) Barcode string number for a device, assigned by the organization using the device. |
| Diagnosis | A diagnosis, which is a disease or injury determined to be present through evaluation of patient history, examination, and/or review of laboratory data. |
| DisplayText | A string meant for reading by a person, for example, accompanying a code. |
| District | The name of the administrative area at a level below that of a state but above that of a city or town. In the US, a county. Outside the US, a district or the equivalent. (Source: HL7 FHIR). |
| DoseForm | The form in which active and/or inert ingredient(s) are physically presented. |
| EffectiveTimePeriod | The date and time span for which something is active, valid, or in force. |
| EmbeddedContent | Abstract class defining the common metadata of all types of encapsulated data, such as images. |
| EncounterClass | Concepts representing classification of patient encounter such as ambulatory (outpatient), inpatient, emergency, home health or others due to local variations. |
| Encounter | A description of an interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient. |
| EncounterType | Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation). |
| Entity | Root class for entities such as people, organizations, and devices that have a separately identifiable existence. |
| EntityOrRole | CIMI parent class for both Entity and Role. |
| EvaluationComponent | A simplified, non-separable evaluation consisting of a finding code (represented by the Concept), value (or exception value), reference range, and interpretation. The subject of the evaluation component is the same as in the parent evaluation. |
| ExceptionValue | Reason that a value associated with a test or other finding is missing. |
| ExcludeFlag | If true, exclude the subjects that match the criterion. |
| ExpirationDate | When the item (medication, device, etc.) will expire. |
| FamilyName | The portion of a person’s name that reflects the genealogy of the person. In western cultures, this is the ‘last’ name. In eastern cultures, the family name appears before the person’s given name(s). In some cultures (e.g. Eritrea) the family name of a son is the first name of his father. (Source: HL7 V3). |
| FindingMethod | The technique used to create the finding, for example, the specific imaging technical, lab test code, or assessment vehicle. |
| FindingSiteConditionAbsenceStatement | Absence of a distinct anatomical or pathological morphological feature or organizational pattern, acquired or innate. Examples include tissue types, tumors, and wounds. Body structures are continuants that allow observations of the same body structure to be related to be tracked over time. |
| FindingSiteConditionPresenceStatement | Presence of a distinct anatomical or pathological morphological feature or organizational pattern, acquired or innate. Examples include tissue types, tumors, and wounds. Body structures are continuants that allow observations of the same body structure to be related to be tracked over time. |
| FindingStatement | Any clinical statement representing a finding. |
| GeopoliticalLocation | The countries of the world and major geopolitical subregions, such as US states. |
| GivenName | The person’s given name - e.g., John |
| GroupCharacteristicCode | A code describing the characteristic present, absent, or having a value in this group. |
| GroupCharacteristic | An inclusion or exclusion criterion as part of defining a cohort. If the criterion is an unary, then TopicCode must be SCT#385432009 (not applicable) |
| Group | A set of entities (personnel, material, or places) to be considered together. May be a pool of like-type resources, a team, or combination of personnel, material and places. |
| HandlingRisk | Cautions on the handling of this specimen. |
| Hash | A hash code of the data (sha-1, base64ed) |
| Headshot | A photograph showing a person’s face. |
| HumanName | The CIMI person name, constrained to map correctly to FHIR. |
| Identifier | A unique string that identifies a specific person or thing. |
| Independent | Base class for classes in CIMI that stand alone. Analogous to FHIR’s DomainResource. |
| InformationEntry | An entry in a patient record or in a report, generally used for the documentation of clinical information about a subject of information such as a patient or a relative of the patient, asserted by a particular source, recorded, and potentially verified. |
| IngredientAmount | The amount of an ingredient in a mixture, as a ratio. For example, 250 mg per tablet is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet. |
| Ingredient | Specifies an material component in a non-medication substance. |
| IntegerQuantity | A Quantity that is an integer. |
| Interpretation | A clinical interpretation of a finding (applies to both assertions and observation). |
| IsActiveIngredient | True if the ingredient is an active ingredient in the medication. |
| Issuer | An organization who issues a qualification, identifier, or license. |
| Language | A human language, spoken or written. |
| LanguageQualifier | Additional information about a person’s use of language. |
| LanguageUsed | Language used for communication by a human, either the subject of record, parent, or other involved person. |
| Laterality | Anatomical location or specimen further detailing the side(s) of interest. |
| Locatable | Abstract top level class in the CIMI hierarchy. The Locatable class reflects CIMI’s implementation using Archetype Description Language (ADL). Its attributes (archetype_node_id, name, and archetype_details) are necessary to serialize CIMI definitions in ADL, but have no clinical relevance. To avoid complicating the profiles with irrelevant extensions, the attributes of Locatable have been omitted. |
| LotNumber | A distinctive alpha-numeric identification code assigned by the manufacturer or distributor to a specific quantity of manufactured material or product within a batch. |
| LowerBound | The lower limit on a range |
| ManufactureDate | When the item (medication, device, etc.) was produced. |
| Manufacturer | The organization producing the product or test. |
| ManufacturerName | The name of the company who produce the device. |
| MaritalStatus | The most recent marital status of a person. |
| Media | A file that contains audio, video, image, or similar content. |
| MedicationIngredient | Specifies an material component in a medication. |
| Medication | A type of prescription drug or over-the-counter drug that is used to prevent, treat, or relieve symptoms of a disease or abnormal condition, but excluding vaccines. |
| Member | A person or entity in a group. |
| MiddleName | The person’s middle name. |
| NameAsText | The name as plain unstructured or semi-structured text. |
| Name | Abstract supertype for the name of an entity. |
| NationalProviderIdentifier | A unique 10 digit number to allow US healthcare providers to identify themselves in a standard way throughout the healthcare industry. |
| NonIndependent | Parent for classes in CIMI that cannot stand alone. These reusable building blocks/data elements can be used to create classes by composition. |
| NonLaboratoryObservation | An observation not based on a specimen. |
| Numerator | The dividend of a fraction. |
| Observation | Represents the result of evaluations (measurements, tests, or questions) that have been performed. Observation has a value representing the result (answer), or an ExceptionValue indicating why the value is not present. The subject of a finding can be the entire patient, or an entity such as a location body structure, intervention, or condition. Things observed about the subject can include social and behavioral factors, subjective and objective observations, and assessments. |
| OnBehalfOf | The party represented by the actual participant. |
| Onset | The beginning or first appearance of a mental or physical disorder. |
| OrganizationAlias | A list of alternate names that the organization is known as, or was known as in the past. |
| OrganizationIdentifier | An identifier of the organization. An NPI preferred, tax id is allowed, and a local id is allowed in addition to ‘authoritative’ identifier |
| Organization | A social or legal structure formed by human beings. |
| OrganizationName | The name of the organization. |
| OverTheCounter | True if the medication is available to consumers without a prescription. |
| Package | The kind of container the medication comes in. |
| PanelMembers | PanelMembers represent the elements of a group of a related but independent evaluations. Examples are the measurements that compose a complete blood count (CBC), or the elements of a pathology report. Each member is an independent evaluation, but the grouping reflects a composite lab order, shared specimen, or a single report author. Typically the Category and Reason are not given for individual findings that are part of the panel, but rather given at the level of the panel itself. |
| PartOf | The larger entity that this is a portion of. For example, an organization might be part of a larger organization, or an encounter with a hospitalist might be part of a larger hospitalization encounter. |
| ParticipationPeriod | The point in time or span of time the participant is involved. |
| Patient | A person in the role of a patient. |
| Person | A person relevant to the health or social situation of the subject (including the person of record him or herself). |
| PersonName | A name used by a human being, written as it would be typically expressed. May include a breakdown of the various elements of the name (family name, given name, etc.). |
| PersonOfRecord | The person this entry belongs to. |
| PhotographicImage | |
| PostalCode | A sequence of letters and digits used as part of a postal address, often designating a geographic region |
| Practitioner | A person who practices a healing art. |
| Precondition | A description of the conditions or context of an observation, for example, under sedation, fasting or post-exercise. Body position and body site are also qualifiers, but handled separately. A qualifier cannot modify the measurement type; for example, a fasting blood sugar is still a blood sugar. |
| Prefix | Contains a set of honorific terms that typically appear before a person’s name, for example Mr., Mrs., Dr., etc. |
| PresentOnAdmission | If the problem or condition existed before the current episode of care. |
| PriorityRank | An indication of the importance of an action. |
| Purpose | Why the item is used. |
| Qualification | A right to practice medicine obtained by training and certification. |
| Quantity | A quantity with units, whose value may be bounded from above or below, as defined in FHIR |
| Range | An interval defined by a quantitative upper and/or lower bound. One of the two bounds must be specified, and the lower bound must be less than the upper bound. When Quantities are specified, the units of measure must be the same. |
| Ratio | A unit of measurement for the quotient of the amount of one entity to another. |
| ReceivedTime | Time the item was delivered to, or accepted by, the receiving facility or unit. |
| Recorded | The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order. |
| RecordedOn | The time of the attribution action. |
| ReferenceRange | The usual or acceptable range for a test result. |
| RelevantTime | The time or time period that the finding addresses. The clinically relevant time is not necessarily when the information is gathered or when a test is carried out, but for example, when a specimen was collected, or the time period referred to by the question. Use a TimePeriod for a measurement or specimen collection continued over a significant period of time (e.g. 24 hour Urine Sodium). |
| ResourceLocation | URI where data can be found. |
| ResourceSize | Number of bytes of content in the resource (if url provided) |
| ResultValue | The finding itself, such as the blood pressure value recorded. |
| Role | Capacity in which an actor is involved in an activity. For instance, ‘attending physician’. Note that attributes of the actor (an entity) that remain constant regardless of the role the actor plays should be part of the entity and not the role. For instance, a person may be a practitioner and a patient. In both cases their date of birth will be the same and thus such information should not be part of the role. |
| SequenceNumber | The sequence number for this specimen in a collection of specimens. |
| Severity | Degree of harshness or extent of a symptom, disorder, or condition. |
| Signatory | The party signing. |
| Signature | A digital Signature - XML DigSig, JWT, Graphical image of signature, etc. |
| SignatureType | Type of signature |
| Signed | Provenance information specific to the signing of the clinical statement. |
| SimpleQuantity | A quantity where the comparator is not used, as defined in FHIR |
| SourceSpecimen | Identifier for the source specimen from which this specimen was derived. |
| SpecialHandling | Information about the proper handling of the specimen. |
| SpecimenContainer | Direct container of specimen (tube/slide, etc.) |
| Specimen | A specimen is a substance, physical object, or collection of objects, that the laboratory considers a single discrete, uniquely identified unit that is the subject of one or more steps in the laboratory workflow. A specimen may include multiple physical pieces as long as they are considered a single unit within the laboratory workflow. A specimen results from one to many specimen collection procedures, and may be contained in multiple specimen containers. Specimen may have one or more processing activities. |
| SpecimenQuantity | Quantity of specimen within container. |
| SpecimenStatus | State of the specimen, such as obtained, processed, used. |
| SpecimenTreatment | Treatment performed on the specimen. |
| SpokenLanguageProficiency | Accuracy and fluency in spoken communication in a language. |
| StageDetail | The full staging information |
| Stage | The relative advancement in the course of a disease. The value is the summary stage or stage group. StageDetail optionally contains the full staging information. |
| State | Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes). (Source: HL7 FHIR). |
| StatementTopic | Compositional and reusable grouping of clinical statement attributes that make up the clinical focus of a statement. StatementTopic class attributes are aligned with SNOMED CT Concept Model attributes when such an overlap exists. Note that this class does not include contextual attributes such as the nature of the action (ordered, proposed, planned, etc…), the nature of the patient state being described (e.g., present, suspected present, absent), and the attribution of this information (the who, when, where, how, why of the information recorded). |
| Status | The current standing or state. |
| Substance | Any matter of defined composition that has discrete existence, whose origin may be biological, mineral or chemical. |
| Suffix | Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name. |
| TelecomNumberOrAddress | A user name or other identifier on a telecommunication network, such as a telephone number (including country code and extension, if necessary), email address, or SkypeID. |
| TimePeriodEnd | The time at which something is to end or did end. Boundary is considered inclusive. |
| TimePeriod | A period of time defined by a start and end time, date, or year. If the start element is missing, the start of the period is not known. If the end element is missing, it means that the period is ongoing, or the start may be in the past, and the end date in the future, which means that period is expected/planned to end at the specified time. The end value includes any matching date/time. For example, the period 2011-05-23 to 2011-05-27 includes all the times from the start of the 23rd May through to the end of the 27th of May. |
| TimePeriodStart | The time at which something is to take effect, start, or did start. Boundary is considered inclusive. |
| Title | A distinguishing word or group of words naming an item. |
| TopicCode | The concept representing the finding or action that is the topic of the statement. For action topics, the TopicCode represents the action being described. For findings, the TopicCode represents the ‘question’ or property being investigated. For evaluation result findings, the TopicCode contains a concept for an observable entity, such as systolic blood pressure. For assertion findings, the TopicCode contains a code representing the condition, allergy, or other item being asserted. In all cases, the TopicCode describes the topic of the action or the finding. |
| Type | The most specific code (lowest level term) describing the kind or sort of thing being represented. |
| Units | Code for the unit of measure of the quantity. |
| UpperBound | The upper limit on a quantitative value. |
| Url | A unique URL on which the device may be contacted directly. |
| VendorModelNumber | The model number of the device, assigned by the manufacturer or vendor. |
| VerificationStatus | Whether an assessment has been confirmed by testing or observation. CIMI Alignment: This attribute has been defined to align with FHIR. In AllergyIntolerance, the type is code. |
| Version | A number or code associated with the product that identifies a particular release iteration. |
| WhenClinicallyRecognized | The time at which a condition or condition was first identified in a healthcare context. |
| WoundAnatomicalLocation | |
| WoundArea | Area of the wound. |
| WoundAssessmentInterpretation | Overall assessement of whether the wound is within normal parameters. |
| WoundBedAppearance | Appearance of wound base (bed). |
| WoundBedAppearancePercentage | Area of wound bed appearance/Entire Area of wound bed. |
| WoundBedColorAreaPercentage | Wound bed area identified by color/Area of wound bed. |
| WoundBedColor | Color of Wound base (bed). |
| WoundDepth | Depth of the wound. |
| WoundEdgeColor | Color of Wound edge. |
| WoundEdgeDescription | Edge of wound description. |
| WoundEpisode | Wound episode refers to a period of the wound, an incident in the course of a wound |
| WoundExudateAmount | Drainage amount of wound |
| WoundExudateAppearance | Appearance of exudate from wound |
| WoundExudateColor | Color of exudate from wound |
| WoundExudateOdor | Odor of exudate from wound |
| WoundExudatePresentOrAbsent | The presence or absence of wound exudate. |
| WoundExudateVolume | Appearance of exudate from wound |
| WoundIdentifier | A human-readable identifier for the lesion; e.g., a letter or integer. |
| WoundLength | Length of the wound (longest dimension). |
| WoundPeriwoundDescription | A description of the skin around the wound (periwound). Color, induration, warmth and edema should be assessed. Redness of the surrounding skin can be indicative of unrelieved pressure. Irritation of the surrounding skin can result from exposure to feces or urine, a reaction to the dressing or tape, or inappropriate removal of dressing or tape. Redness, tenderness, warmth and swelling are classical clinical signs of infection. [Reference: Brown, P., 2009] |
| WoundPressureUlcerAssociation | Is the wound associated with a device or pressure point? |
| WoundTrend | Whether a condition is improving, worsening, stable, or resolved. |
| WoundTunnelClockDirection | Clock position of wound tunnel |
| WoundTunnelLength | Length of wound tunneling. |
| WoundTunnelingPresentOrAbsent | The presence or absence of wound tunneling. |
| WoundTypeEtiology | A specialization of condition cause, specific to the causes of injuries (or not having injury in the wound absent context). |
| WoundType | A type code describing the wound or skin injury. Differentiating pressure ulcers and other types of wounds is important for an accurate count of their number and for identifying appropriate wound treatment. The values will be used for documenting and retrieving data regarding the number and types of wounds present. |
| WoundUnderminingClockDirection | Clock position of wound undermining |
| WoundUnderminingLength | Length of wound undermining. |
| WoundUnderminingPresentOrAbsent | The presence or absence of wound undermining. |
| WoundVisibleInternalStructure | Exposed body structures, devices, and/or foreign bodies visible by the naked eye in a wound. |
| WoundWidth | Width of the wound (perpendicular to longest dimension). |
| WrittenLanguageProficiency | Accuracy and fluency of reading and writing in a language. |
HL7 FHIR Profile: Skin and Wound Assessment, Release 1 (For Comment), Version: 1.0.0 ; FHIR © Version: 3.0.1 ; Generated on Fri, Aug 17, 2018 15:29-0400.


Welcome to Rush n' Crush pre-pre-alpha
Enter Game
Sorry about the crappy intro screen, we are working on it, I swear


{% extends "base.html" %} {% block title %}URL Shortened{% endblock %} {% block content %}
Your URL has been shortened to {{ shortened_url }}.


Weekly notes and summarized readings for Summarized readings for Model Integrated Computing (Fall 2020, Vanderbilt University)


|
LostInCompilation
0.1.0
|
#include <Logger.h>
Public Types | |
| typedef _LogLevel | LogLevel |
| typedef _LogConfigOption | LogConfigOption |
Public Member Functions | |
| virtual | ~Logger () |
| void | configure (const std::string &outputFile, LogConfigOption option, LogLevel fileVerbosityLevel, LogLevel screenVerbosityLevel) |
| void | print (LogLevel verbosityLevel, const char *fileName, const int codeLineNum, const std::string &message) |
Static Public Member Functions | |
| static Logger * | getInstance () |
Static Public Attributes | |
| static const LogLevel | LEVEL_OFF = _LEVEL_OFF |
| static const LogLevel | LEVEL_ERROR = _LEVEL_ERROR |
| static const LogLevel | LEVEL_WARN = _LEVEL_WARN |
| static const LogLevel | LEVEL_INFO = _LEVEL_INFO |
| static const LogLevel | LEVEL_DEBUG = _LEVEL_DEBUG |
| static const LogLevel | LEVEL_TRACE = _LEVEL_TRACE |
| static const LogLevel | LEVEL_ALL = _LEVEL_ALL |
| static const LogConfigOption | file_on = _file_on |
| static const LogConfigOption | file_off = _file_off |
| static const LogConfigOption | screen_on = _screen_on |
| static const LogConfigOption | screen_off = _screen_off |
| static const LogConfigOption | file_append = _file_append |
Private Types | |
| enum | _LogLevel { _LEVEL_OFF = 10000, _LEVEL_ERROR = 8000, _LEVEL_WARN = 7000, _LEVEL_INFO = 5000, _LEVEL_DEBUG = 3000, _LEVEL_TRACE = 2000, _LEVEL_ALL = 0 } |
| enum | _LogConfigOption { _file_on = 1 << 0, _file_off = 1 << 1, _screen_on = 1 << 2, _screen_off = 1 << 3, _file_append = 1 << 4 } |
Private Member Functions | |
| Logger () | |
Private Attributes | |
| bool | _isConfigured |
| std::string | _logFileName |
| LogConfigOption | _configOption |
| std::ofstream | _out |
| struct timeval | _initTime |
| size_t | _fileVerbosityLevel |
| size_t | _screenVerbosityLevel |
Static Private Attributes | |
| static Logger * | INSTANCE = nullptr |
A simple Logger implementation that provides 1) Output the logging message on screen and/or on a file 2) Predefined prioritized logging level for filtering.
| typedef _LogLevel Logger::LogLevel |
|
private |
|
private |
|
virtual |
|
private |
| void Logger::configure | ( | const std::string & | outputFile, |
| Logger::LogConfigOption | option, | ||
| Logger::LogLevel | fileVerbosityLevel, | ||
| Logger::LogLevel | screenVerbosityLevel | ||
| ) |
|
static |
| void Logger::print | ( | Logger::LogLevel | verbosityLevel, |
| const char * | fileName, | ||
| const int | codeLineNum, | ||
| const std::string & | message | ||
| ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |
|
static |
|
static |
|
staticprivate |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |


calling a helper ...
ERROR: Microphone is missingTo use this you need either 1) micrphone or 2) camera with microphone or 3) laptop.


Missing Children Minnesota is a 501(c)(3) non-profit, one of the oldest child search agencies in the country, and the oldest in the Midwest. MCM began in 1983 as a support group for parents of missing children to offer moral support and comfort to each other during their ordeal. Out of that group came the idea there should be a Minnesota-based resource for parents and families dealing with the issue of missing children.
Since its inception, we have helped thousands of families with information, support and referral services in their search for their missing children. We have educated thousands of children, parents, educators, and other professionals on the subject of personal safety for children. We have functioned as a resource for information to the public on the issue of missing children.
Missing Children Minnesota is a Charter Member of the Association of Missing and Exploited Children’s Organizations (AMECO) and a Member Organization of Community Shares of Minnesota (CSMN).
The Mission of Missing Children Minnesota is to assist in locating missing children; provide advocacy and support services to families of missing children; and to provide information and education to the public about missing children, runaways, and abduction prevention.
In 1983, we participated in the re-writing of Minnesota’s parental kidnapping statute SS609.26.
In 1984, this group of parents incorporated as the Missing Kids Action Agency. The name was changed to Missing Children Minnesota in 1986.
In 1990, two delegates from MCM were invited to serve on Governor Rudy Perpich’s Governor’s Task Force on Missing Children.
In 1991, the legislature passed the Missing Children’s Act, which included registration of sex offenders, flagging of school records, and additional rewriting of the parental kidnapping statute.
Missing Children Minnesota continues to provide thousands of families with information, support and referral services in their search for their missing children.
Missing Children Minnesota is a charter member of the Association of Missing and Exploited Children’s Organizations (AMECO).
As a Member of AMECO, we pledge to abide by the following:
We must renew membership annually with an Annual Membership Report detailing our work in the communities of Minnesota.
Missing Children Minnesota is a member of Community Shares of Minnesota.
Your donations will make a difference in the life of a child. Consider making a tax-deductible contribution today.


Server {{serverName}} was created.
Some sample text
{{ myName }}
{{ myName | lowercase}}
{{ myName | uppercase}}
{{ mySalary | number: '4.4-5' }}
{{ mySalary | currency: 'INR'}}
{{ myJoiningDate | date: 'short'}}
{{ myJoiningDate | date: 'medium'}}
{{ myJoiningDate | date: 'dd/MM/YYYY'}}
{{ myJoiningDate | date: 'long'}}
{{ myJoiningDate | date: 'long' | uppercase}}


Judging which ideas are good is something ordinarily put in the domain of humans, and even then humans often can't agree on which ideas are good and which aren't. Can we use software to judge which ideas are good? Using some innovative heuristics, I believe I have come across a way to do this.


A Marketplace that allows college students to buy and sell books from each other, allowing for faster transactions, and allowing students to sell for more than they would if they sold to the bookstore or other third party resellers.
Tech: Spring framework, RESTful webservices, PostgreSQL
A Java based backend API, designed to allow users to see and join events, make acquaintances with other people at an event, and attach personal notes to other people
Tech: Spring framework, RESTful web services, PostgreSQL
A Social Media web app allowing people to create public ‘Gabbles’, short 140-character messages, for anyone to see and ‘like’
Tech: Node, Express, Javascript, HTML, CSS, PostgreSQL
A fairly simple static webpage, demonstrating knowledge of responsive web design.
Tech: HTML, CSS


Knownly is proud to support students, teachers, open source projects and other non-profits with free upgrades.
We love seeing creativity and people making ideas known!
If you fall into one of the above categories, just send us an email with a quick outline of your situation. We'll respond with a voucher code to claim below.
| Voucher Code | Redeemed At | Campaign |
|---|---|---|
| {{ redemption.voucher.voucher_code }} | {{ redemption.redeemed_at|date }} | {{ redemption.voucher.campaign.name }} |


Spacecraft Retrieval#
This tutorial will walk you through how to simulate reflectance spectra of an atmosphere containing Martian dust as observed from an orbiter. Then, we’ll use these simulations to perform a retrieval.
For all of this, I assume pyRT_DISORT is imported
import pyrt
import disort
Note
All code used in this example is collected in a script located at ~/pyRT_DISORT/docs_source/rst/for-users/guides/spacecraft_retrieval.py
Note
Variables defined in all caps will be the ones that we ultimately plug into the DISORT call, and they adhere to the same naming convention that DISORT uses (for the benefit of those who have worked with DISORT before).
Angles#
Let’s begin by assuming we have a hyperspectral imager on an orbiter that takes 2D images such that the data have shape (15, 20) and each pixel in this grid contains the same 5 wavelengths. Real data might have more pixels and more wavelengths, but the scenario seems plausible enough.
Each pixel will have its own unique combination of incidence, emission, and phase angles—angles that don’t depend on wavelength. Let’s create a set of angles defined in each of these 300 pixels to use in this example (for simplicity of the example, let’s assume that all three of these angles are the same).
import numpy as np
dummy_angles = np.outer(np.linspace(5, 10, num=15),
np.linspace(5, 8, num=20))
Attention
The angles must be in degrees.
In this scenario, we need to make the azimuth angles of each pixel. We can do
that with azimuth()
. Let’s go ahead and do that, and create the
other angular variables needed.
UMU = np.cos(np.radians(dummy_angles)) # since dummy_angles is emission
UMU0 = np.cos(np.radians(dummy_angles)) # since dummy_angles is incidence
PHI = pyrt.azimuth(dummy_angles, dummy_angles, dummy_angles)
PHI0 = np.zeros(PHI.shape)
This computes all of the angular quantities for the same time at each pixel.
DISORT expects the input of UMU0
and PHI0
to be floats, which
we can obtain by choosing the pixel’s indices. It expects UMU
and
PHI
to both be 1D arrays (here, both are length 1 since, again, each
pixel has only 1 set of emission and azimuth angles) which we got the same way.
UMU = UMU[0, 0]
UMU0 = UMU0[0, 0]
PHI = PHI[0, 0]
PHI0 = PHI0[0, 0]
Note
In the case where DISORT wants a 1D array, you can give it a scalar value and f2py will convert it to an array when DISORT is called.
Wavelengths#
Let’s now turn our attention to the spectral information provided by the instrument. I’ll define some wavelengths so we have some values to work with.
pixel_wavelengths = np.array([1, 2, 3, 4, 5]) / 5
spectral_width = 0.05
Attention
The wavelengths must be in microns.
If we want the wavenumbers (if, for instance, we want to include thermal emission) we can compute them here.
WVNMHI = pyrt.wavenumber(pixel_wavelengths - spectral_width)
WVNMLO = pyrt.wavenumber(pixel_wavelengths + spectral_width)
These spectral quantities have shape (5,)—the same as the input wavelengths. For now, I’ll keep the spectral dimension but be aware that we’ll cut off the spectral dimension closer to when we do the simulation because DISORT requires a separate call for each wavelength.
Equation of state#
Let’s now start creating the atmospheric model. We’ll start by creating the model boundaries and equation of state variables.
Suppose we have a pressure and temperature profile for a given pixel, along with the altitudes where these are defined.
altitude_grid = np.linspace(100, 0, num=15)
pressure_profile = 500 * np.exp(-altitude_grid / 10)
temperature_profile = np.linspace(150, 250, num=15)
mass = 7.3 * 10**-26
gravity = 3.7
Attention
To keep with DISORT’s convention that altitudes start from the top of the atmosphere, the altitude and altitude grid must be decreasing.
If the hydrostatic approximation is adequate, we can create the column density in each model layer, which we’ll happen to need to compute the Rayleigh scattering optical depth in each model layer.
column_density = pyrt.column_density(pressure_profile, temperature_profile, altitude_grid)
We can also make some variables that DISORT needs in special cases.
TEMPER = temperature_profile
H_LYR = pyrt.scale_height(temperature_profile, mass, gravity)
Rayleigh scattering#
Now that we know the boundaries of our model, let’s start building it. What we’ll do is essentially create atmospheric arrays for Rayleigh scattering, then do the same thing with dust, and then combine them to get the total model arrays.
rayleigh_co2 = pyrt.rayleigh_co2(column_density, pixel_wavelengths)
This creates a Column, which is pyRT_DISORT’s fundamental object. It collects the optical depth, single scattering albedo, and phase function of each atmospheric constituent. We can access these arrays via the object’s properties.
rayleigh_co2.optical_depth
rayleigh_co2.single_scattering_albedo
rayleigh_co2.legendre_coefficients
These arrays have shapes (14, 5), (14, 5), and (3, 14, 5)—the same shapes
DISORT expects for DTAUC
, SSALB
, and PMOM
but with an extra
wavelength dimension tacked on to the end. This class computed the arrays
at all wavelengths at once, so don’t get tripped up when computing these
composite arrays.
Tip
If you want to see the total optical depth due to Rayleigh scattering at the input wavelengths, you can execute the line
np.sum(rayleigh_co2.optical_depth, axis=0)
to see the column integrated optical depth. For this example it gives
[1.62009710e-04 1.00123336e-05 1.97362248e-06 6.23917610e-07 2.55522160e-07]
Aerosols#
We just created 3 arrays for Rayleigh scattering; now, we need to make the same arrays for dust.
Vertical profile#
First, we need to define a vertical volumetric mixing ratio profile for dust. Let’s use a Conrath pfoiel. For our retrieval, this profile will be used to define the aerosol weighting within the layers. Let’s assume the midpoint altitudes are a good representation of the layer altitudes and construct them here.
altitude_midpoint = (altitude_grid[:-1] + altitude_grid[1:]) / 2
We can then set the Conrath parameters and construct a profile.
q0 = 1
nu = 0.01
dust_profile = pyrt.conrath(altitude_midpoint, q0, 10, nu)
With this profile, we can start to construct the dust’s forward scattering properties.
Forward scattering properties#
Next, we need the dust’s forward scattering properties. I don’t include any forward scattering properties with pyRT_DISORT; instead I presume you’ve computed these with some T-matrix computations. Normally, you’d read these in but here I’ll define some dummy properties.
particle_size_grid = np.linspace(0.5, 10, num=50)
wavelength_grid = np.linspace(0.2, 50, num=20)
extinction_cross_section = np.ones((50, 20))
scattering_cross_section = np.ones((50, 20)) * 0.5
I leave it up to you to use scipy’s interpolation routines if you want to interpolate the properties onto another grid, but I’ll assume what I defined above is the result of the interpolation (or good enough).
We then need to define the particle size gradient for each model layer.
particle_size_gradient = np.linspace(1, 1.5, num=len(altitude_midpoint))
From this, we can now compute the dust’s optical depth. Let’s suppose (presumably because someone else told us so) that the column-integrated optical depth is 1 at 9.3 microns. We can compute the extinction ratio between 9.3 microns and the wavelengths of our T-matrix grid, regrid this array onto the altitude and wavelength grid of our model, and then use atmospheric properties to get the optical depth in each model layer at each wavelength.
ext = pyrt.extinction_ratio(extinction_cross_section, particle_size_grid, wavelength_grid, 9.3)
ext = pyrt.regrid(ext, particle_size_grid, wavelength_grid, particle_size_gradient, pixel_wavelengths)
dust_optical_depth = pyrt.optical_depth(dust_profile, column_density, ext, 1)
The variable dust_optical_depth
has a shape of (14, 5), meaning it’s the
optical depth of each model layer, computed at all model wavelengths.
The single scattering albedo is a bit simpler to compute.
dust_single_scattering_albedo = pyrt.regrid(scattering_cross_section / extinction_cross_section, particle_size_grid, wavelength_grid, particle_size_gradient, pixel_wavelengths)
Legendre coefficients#
The Legendre coefficients essentially work the same way as above. I presume you have these from the T-matrix computations, though I provide functions to decompose phase functions into its Legendre moments. I also provide functions for working with a Henyey-Greenstein phase function.
dust_pmom = np.ones((128, 50, 20))
dust_legendre = pyrt.regrid(dust_pmom, particle_size_grid, wavelength_grid, particle_size_gradient, pixel_wavelengths)
Column#
As a last step for dust, let’s bundle all these properties together in a Column.
dust_column = pyrt.Column(dust_optical_depth, dust_single_scattering_albedo, dust_legendre)
Atmospheric model#
We’ve done the hard work of creating all the atmospheric arrays for the individual constituents. Now we just need to put everything together, which we can do by adding the columns together. We’ve constructed the columns for each of the atmospheric constituents, so we just need to construct a composite atmospheric model. All the composite arrays are stored in the object’s properties.
model = rayleigh_co2 + dust_column
DTAUC = model.optical_depth
SSALB = model.single_scattering_albedo
PMOM = model.legendre_coefficients
Computational parameters#
We can now set a number of computational parameters. These aren’t strictly necessary, but are useful in the off chance we made an error when constructing an input.
Note
These are optional to pyRT_DISORT because it can infer them from array shapes when DISORT is called. They are not optional in the original FORTRAN implementation.
MAXCLY = len(altitude_midpoint)
MAXMOM = PMOM.shape[0]
MAXCMU = 16 # AKA the number of streams
MAXPHI = 1
MAXUMU = 1
MAXULV = len(altitude_midpoint) + 1
The geometry of this situation dictates that the number of azimuth and polar angles are both 1. The number of Legendre coefficients from the T-matrix computations set the number of moments. The vertical grid set the number of computational layers and user levels. The number of streams can be changed.
Model behavior#
We can also set how we want the model to behave. These are some example values but you can change these to your liking
ACCUR = 0.0
DELTAMPLUS = True
DO_PSEUDO_SPHERE = False
HEADER = ''
PRNT = None
EARTH_RADIUS = 6371
Radiation#
Let’s now specify the flux and thermal quantities used in the model.
Incident flux#
We can define the beam flux and the isotropic flux at the top of the atmosphere.
FBEAM = np.pi
FISOT = 0
At least for our Martian simulation, there’s no real need to worry about the isotropic flux from space.
Thermal emission#
We can also define whether thermal emission is used in the model. For this example, we’ll ignore thermal emission but this code snippet shows how you may define some variables. If no thermal emission is used, the other variables can be any floats.
PLANK = False
BTEMP = temperature_profile[-1]
TTEMP = temperature_profile[0]
TEMIS = 1
Output#
Arrays#
Next, we’ll create some output arrays. DISORT evidently needs these empty arrays to be initialized and it’ll fill them as it runs.
ALBMED = pyrt.empty_albedo_medium(MAXUMU)
FLUP = pyrt.empty_diffuse_up_flux(MAXULV)
RFLDN = pyrt.empty_diffuse_down_flux(MAXULV)
RFLDIR = pyrt.empty_direct_beam_flux(MAXULV)
DFDT = pyrt.empty_flux_divergence(MAXULV)
UU = pyrt.empty_intensity(MAXUMU, MAXULV, MAXPHI)
UAVG = pyrt.empty_mean_intensity(MAXULV)
TRNMED = pyrt.empty_transmissivity_medium(MAXUMU)
Behavior#
We have yet more switches to tell DISORT how to run.
IBCND = False
ONLYFL = False
USRANG = True
USRTAU = False
Surface#
With the number of computational parameters defined, we can now make the arrays of the surface reflectance. Let’s say we want to use a Hapke surface with known values for its parameterization. We can use the variables we’ve previously defined and these known parameters to compute the surface phase function arrays.
ALBEDO = 0 # this seems to only matter if the surface is Lambertian
LAMBER = False
b0 = 1
h = 0.06
w = 0.7
RHOQ, RHOU, EMUST, BEMST, RHO_ACCURATE = pyrt.make_hapke_surface(USRANG,
ONLYFL, MAXUMU, MAXPHI, MAXCMU, UMU, UMU0, PHI, PHI0, FBEAM, 200, b0, h, w)
Oddball#
This one doesn’t fit in with the others in my mind. If we want the radiant quantities to be returned at user-specified boundaries, we need to tell DISORT what those boundaries are. If we don’t specify these, it’ll return them at the layers of our model, which is perfectly fine in this case.
UTAU = np.zeros((MAXULV,))
Running the model#
We have all the variables we need to simulate some reflectance curves. Recall that we’ve been making properties (where applicable) at all 5 wavelengths at once. Unfortunately DISORT can’t natively handle this, so we need to loop over wavelength. I’ll import the necessary module and create an array that’ll be filled as DISORT runs.
test_run = np.zeros(pixel_wavelengths.shape)
Once we carefully put all ~50 variables in the correct order and remember to only select parts of the arrays we need (slicing off the wavelength dimension), we can do simulations.
for ind in range(pixel_wavelengths.size):
rfldir, rfldn, flup, dfdt, uavg, uu, albmed, trnmed = \
disort.disort(USRANG, USRTAU, IBCND, ONLYFL, PRNT, PLANK, LAMBER,
DELTAMPLUS, DO_PSEUDO_SPHERE, DTAUC[:, ind], SSALB[:, ind],
PMOM[:, :, ind], TEMPER, WVNMLO, WVNMHI,
UTAU, UMU0, PHI0, UMU, PHI, FBEAM, FISOT,
ALBEDO, BTEMP, TTEMP, TEMIS, EARTH_RADIUS, H_LYR, RHOQ, RHOU,
RHO_ACCURATE, BEMST, EMUST, ACCUR, HEADER, RFLDIR,
RFLDN, FLUP, DFDT, UAVG, UU, ALBMED, TRNMED)
test_run[ind] = uu[0, 0, 0]
print(test_run)
This prints [0.11399675 0.06681997 0.06493594 0.06464735 0.06458137]
.
Retrieval#
We were able to make simulations in the previous section, but now let’s suppose we want to retrieve the dust optical depth (instead of treating it as a fixed quantity). All that we really need to do is run simulations with a bunch of different optical depths and see which one matches an observation the best … though the implementation details aren’t quite so crude. To demonstrate how to do this, let’s suppose the result of our simulation above where the dust optical depth was 1 was a measured quantity and let’s also pretend we have no idea what the dust optical depth is.
The simulated spectrum acts as our measured I/F.
rfl = np.array([0.11399675, 0.06681997, 0.06493594, 0.06464735, 0.06458137])
If we want to retrieve a scalar optical depth over this spectral range we want a function that accepts a test optical depth and finds the optical depth that best fits this spectrum. The following function does that
def simulate_spectra(test_optical_depth):
dust_optical_depth = pyrt.optical_depth(dust_profile, column_density, ext, test_optical_depth)
dust_column = pyrt.Column(dust_optical_depth, dust_single_scattering_albedo, dust_legendre)
model = rayleigh_co2 + dust_column
od_holder = np.zeros(n_wavelengths)
for wav_index in range(n_wavelengths):
rfldir, rfldn, flup, dfdt, uavg, uu, albmed, trnmed = \
disort.disort(USRANG, USRTAU, IBCND, ONLYFL, PRNT, PLANK, LAMBER,
DELTAMPLUS, DO_PSEUDO_SPHERE, DTAUC[:, wav_index], SSALB[:, wav_index],
PMOM[:, :, wav_index], TEMPER, WVNMLO, WVNMHI,
UTAU, UMU0, PHI0, UMU, PHI, FBEAM, FISOT,
ALBEDO, BTEMP, TTEMP, TEMIS, EARTH_RADIUS, H_LYR, RHOQ, RHOU,
RHO_ACCURATE, BEMST, EMUST, ACCUR, HEADER, RFLDIR,
RFLDN, FLUP, DFDT, UAVG, UU, ALBMED, TRNMED)
od_holder[wav_index] = uu[0, 0, 0]
return np.sum((od_holder - rfl)**2)
If I only want to retrieve the dust optical depth, nothing in this guide before the place where I define the optical depth is affected; that is, the equation of state, input angles, input wavelengths, etc. don’t need modification. In fact, only the atmospheric model cares about the different optical depths. I create an empty array that will hold the values as DISORT is run at each of the wavelengths (just like before) and populate it along the way, but I only return the square of the distance from the target spectrum. This essentially tells us how close the input optical depth is to the target. If we minimize the output of this function, we found the best fit dust optical depth.
Fortunately, scipy has some minimization routines for just this sort of thing. I’ll use their Nelder-Mead algorithm (a slower but robust algorithm) but feel free to use another one if you’ve got more familiarity with them. All we need to do is provide it a function to minimize (which we just defined) along with an initial guess. This particular algorithm also has some bounds so I can tell it not to try negative optical depths.
from scipy import optimize
def retrieve_od(guess):
return optimize.minimize(simulate_spectra, np.array([guess]),
method='Nelder-Mead', bounds=(0, 2)).x
Now let’s do a retrieval where we guess that the optical depth is 1.5 and see how it performs, along with how long it takes to run.
import time
t0 = time.time()
print(retrieve_od(1.5))
t1 = time.time()
print(f'The retrieval took {(t1 - t0):.3f} seconds.')
On my computer this outputs
[0.99997559]
The retrieval took 0.351 seconds.
Seems decent to me.


| Created: | 5/25/2019 10:37:21 AM |
| Modified: | 5/30/2019 7:23:55 PM |
| Project: | |
| Advanced: |
| Attribute |
|
Private int landmark-type |
|
Details:
|
|
Private int landmark-name |
|
Details:
|
|
Private int landmark-point-name |
|
Details:
|
|
Private int location-rank |
|
Details:
|
| Element | Source Role | Target Role |
|
AlternateRouteDetail Class |
Name: destination |
Name: |
|
Details:
|
||
|
«Choice» EventLocation Choice |
Name: |
Name: |
|
Details:
|
||
|
«Choice» EventDescription Choice |
Name: related-landmark |
Name: |
|
Details:
|
| Element | Source Role | Target Role |
|
GeoLocation Class |
Name: |
Name: |
|
Details:
|
||
|
AreaLocation Class |
Name: |
Name: |
|
Details:
|
| Object | Type | Connection | Direction | Notes |
| AlternateRouteDetail | Class | Strong | To | |
| «Choice» EventLocation | Choice | Strong | To | |
| GeoLocation | Class | Strong | From | |
| AreaLocation | Class | Strong | From | |
| «Choice» EventDescription | Choice | Strong | To |


{% load i18n %}{% url profile_detail username=creator.username as creator_url %}
{% if group %}
{% blocktrans with image.get_absolute_url as image_url and group.get_absolute_url as group_url %}{{ creator }} has added an image '{{ image }}' in '{{ group }}'.{% endblocktrans %}
{% else %}
{% blocktrans with image.get_absolute_url as image_url %}{{ creator }} has added an image '{{ image }}'.{% endblocktrans %}
{% endif %}


Everything regarding your site's global configuration, is found in one single file; _config.yml
Most of the variables there are pretty much self explanatory, i.e the title
sets the site's title, the email
sets the site's email, etc.
For a full listing of what you can do with the site's configuration, check Jekyll's Configuration docs page.
YB uses a couple of extra settings, like paginate
and excerpt_separator
. The paginate
variable sets the number of posts teasers per page and the excerpt_separator
sets the end of the post teaser. More on these variables, can be found at their corresponding sections in the docs.
Keep in mind that for any changes in _config.yml
to be applied, you need to restart the Jekyll server.


Hidayah
Home
Portfolio
Blog
Contact
Get in touch with us by filling
contact form below
Your message has been sent. Thank you!
Submit message
* Please fill all required form field, thanks!


Toggle navigation
Home
(current)
Polls
Browse All Polls
Browse All Polls [Velocity]
Add New Poll
Manage Polls
Submit
Link
Dropdown
Action
Another action
Something else here
Separated link
IPT Reactive Robotics Demo
Reactor, WebSocket, RxJS & Angular 2
loading...
Reactive Robot Tag Cloud
Anything in here will be replaced on browsers that support the canvas element
Reactor
RxJava
IPTPI Robot
Reactive
WebSocket
Pi4J
IoT
Cloud
{{wish.clicks}}
{{wish.title}}
Your Wish:
Add Your Wish


Sign Up
Log In
Sign Up for Free
First Name
*
Last Name
*
Email Address
*
Gender
*
Mobile No
*
Password
*
Get Started
Welcome Back!
Email Address
*
Password
*
Forgot Password?
Log In


German Programmers1
German Programmers2
German Programmers3
German Programmers4
German Programmers5
German Programmers6
Hello German Programmers
In Web development course
Welcome to Our Course


--- title: Shipyard Components components: [Grid, Boxes, Buttons, Empty States, Alerts, Notes, Forms, Icons, Modals, Tooltips, Code, Tables] --- {% include page-heading.html page=page %}


Notification Styles
Simple, easy and effective ideas & animation effects for website notifications
Click on this button to show the notification:
Show Notification
Growl-like:
Scale
Jelly
Slide in
Genie


Processor uses the Apache Velocity template engine to merge flow file attributes with a given template.
Use the SplitToAttribute processor to split the incoming data row - a single row of CSV data - into individual fields and assign these fields to flow file attributes. The MergeTemplate processor then merges the attributes with an Apache Velocity template and the flow file content contains the result of the merge operation.
Here is an example of one row from the data:
Peterson, Jenny, New York, USA
The SplitToAttribute processor will assign the values of the data row to flow file attributes. The attribute "Attribute prefix" defines which prefix the attribute should have
and adds a running number for each element (field) of the data row like this e.g.:
column_001 = Peterson
column_002 = Jenny
column_003 = New York
column_004 = USA
And then simple idea is to reformat the values to e.g. JSON format like this:
{
"name": "Peterson",
"first": "Jenny",
"city": "New York",
"country": "USA"
}
To achieve this simply create a template - a simple text file that is placed in the filesystem. Specify in the properties of the processor the path where the template is situated and the name of the template. In the template, replace the values in the JSON example above with placeholders like this:
{
"name": "$column_000",
"first": "$column_001",
"city": "$column_002",
"country": "$column_003"
}
The placeholders in the template will be replaced with the real values from the relevant attributes. The result will be placed in the flow file content.
For more details about the Apache Velocity template engine and the use of templates go to the Apache Velocity website


Blockchain Bootcamp For Business Professionals
Example Truffle Dapp
You have
Clicks
Test RPC Address:
Contract Address:
start
Add clicks
Add Click
Remove Click
Transaction Data
Transaction Receipt
Transaction Cost
INR:
Hint:
open the browser developer console to view any errors and warnings.


Save Cal: Clicking the yes
submenu saves calibration data to the file: "callut_n.dat" where n is
the serial number for the attached Mini_CT. The serial number is
programmed into Mini_CT along with the assembly code. The serial
number is used to allow more than one curve tracer to reside in a
laboratory. The serial number range is 1 to 127. Zero is reserved.
Load Cal: If a cal file is
present for the attached Mini_CT serial number, it is loaded.
Otherwise, the default calibration file "callut_0" is loaded.
Show Cal Menu: Brings up a
radio button selection menu and instructions on how to calibrate for
the selected item. Calibration should be performed in order. i.e. Top
left to bottom left, then top right to bottom right. Click the Run
button for each calibration step. After the all calibration is
completed, do a
Save Cal to update the calibration load file.
MVZ: Zero collector voltage measurement. Zero for both gain settings
MVC: Calibrate collector voltage measurement. Cal for both gain settings
MIZ: Zero collector current measurement. Zero for five series resistor settings
MIC: Calibrate collector current measurement. Cal for five series resistor settings
CVZ: Zero collector voltage Set.
CVC: Calibrate collector voltage Set.
BVZ: Zero base voltage Set.
BVC: Calibrate base voltage Set.
BIZ: Zero base current Set.
BIC: Calibrate base current Set.
Show Resistor Menu: Part of the
calibration process is to measure the series sense resistors. These
values are stored in the default calibration file. Should you want to
change them, enter the new value, click the
Set R Values button then
Save Cal the calibration file.
Main


Control a canvas from multiple machines
Draw something on the canvas!
Once you've exhausted the fun in this document, you should check out:


Sample Test Execution Dashboard
Based on pass/fail of test executions.
Contains the following visualizations:
- Executions by TestCase
- Executions Results
- Executions by Agent
- Execution Peak Days
Requires index with name “*report*”
Tags: Execution