You've reached Ants' Collaborative Interface Tool (Yeah!) for the 3D visualization of cities through browsers.
This is still a work in progress. Please feel free to contribute !
Move your mouse to go left/right/up/down.
Scroll to zoom in and out.
Click a spot and you'll enter First Person View.
Move your mouse to look around.
Use W-A-S-D keys to move (or Z-Q-S-D for AZERTY keyboards).
Double escape to switch back to Sky View.
 Click to enter CITY !


Hello world!! I am an Ethical Hacker, a Tech Enthusiast, a team player but always a Student, a result oriented person with a back-breaking will to work till the brink combined with an unorthodox take on problems at hand.
Along with the IT team of NDTV Delhi branch, I overlooked the whole network of the renowned NDTV. I learned how a network operates, how things are done in the industry level, how to handle and manage Network Threats if and when they come, configure Firewalls, Switches using command line interface and help in installing patches, analyzing traffic and managing potential threats in the network.
Ongoing || Computer Fundamentals, AlgoDesign and Data Structures, Database Management, Practicum Java Language, Practicum ArtificialIntelligence, Practicum Functional Programming, ComputerGraphics, Practicum Software Engg.
Scanning Networks, enumeration, Vulnerability analysis, system hacking, malware threats, sniffing, session hijacking, evading Ids firewall and honeypots, hacking web servers, hacking web applications, sql injection etc.
Networking Fundamentals, Linux Essentials, Kali Linux, Parrot OS, Metasploit Footprinting & Reconnaissance, Scanning Networks, Hacking System-Webservers-Wireless Networks-Mobile Platforms Tools such as Recon-ng, Nessus , Nikto, Nmap, Netcraft, Burpsuite, SQLmap
A complete tool that checks and prevents DNS as well as ARP spoofing in home routers. It automizes the process of detecting DNS and ARP SPOOFING in home routers.
View ProjectA platform on which users are able to check the level of pollution in their homes and areas around them. We will be employing clustering algorithms as well as certain supervised learning and unsupervised machine learning.
View ProjectBlockchain driven application that prevents data leaks from companies and performs validation and verification of individuals(KYC process) by keeping the record of accesing the data of customer in the form of transactions in a block of blockchain
View Project


The basics of the web
- The web
- HTML
- URLs
- HTTP
- Web Applications
HTML = Hypertext Markup Language (Basics of web)
Hyperlink = Links between
Major Pieces of the web
You (Computer+Browser) -> Internet -> Servers
You [requests] Internet [HTTP (Protocol)]
HTTP communicates with browser
HTML
Heart of the web
HTML is made of:
- Text content : what you see
- Mark up : what it looks like
- References to other documents : eg. images/videos
- Links to other pages
HTML Mark ups
"Tags"
< name > contents < /name >
}called an element
< b >
< b > contents < /b >
b = bold
< em >
< em > contents < /em >
em = italics
HTML Attributes = Links
< tag attr="value") contents < /tag >
< a > = anchor = making links
< a href = "www.reddit.com") derp < /a >
href = attribute name
derp = contents
Images Tag
< img src ="url" alt = "text">
src = attribute source
alt = alternate (text that is displayed when image does not load
alt = "text" is REQUIRED
There is no contents to img so no closing tag necessary = void tag
White Space = breaking lines
< br > = break < void >
< p > = paragraph = < p > contents < /p >
Inline / Block
< br > = Inline (ending a line)
< p > = Block (invisible box that has width and height)
Inline = < b > < em > < img >
Span / Div
span = inline / div = block
< span class="foo">
< div class ="bar">


London's New Bond Street has the most expensive retail rents in Europe
by Jessica ClarkLondon’s New Bond Street is the most expensive shopping street in Europe for retailers to rent store space.
The street in the West End is more expensive than the Avenue de Elysees in Paris and shopping destinations in Milan, Zurich, Vienna and Munich.
Read more: London falls on list of best cities for living and working
New Bond Street is the third most expensive street globally, behind Hong Kong’s Causeway Bay and Upper Fifth Avenue in New York City.
Luxury retailers such as Jimmy Choo, Longchamp and Mulberry have stores on the street, where rents reach $1,714 per sq ft per year.
Covent Garden was the second most expensive street in the capital in the second quarter of the year, at £950 per sq ft per year, according to Cushman & Wakefield
Sloane Street, Oxford Street and Brompton Road made up the reset of the top five for the most costly streets for retailers in London.
Peter Mace, head of Cushman & Wakefield’s central London team, said: ““New Bond Street carries such a high retail rent premium over other London streets due to its global renown amongst luxury retailers, who perceive representation here, alongside other locations in New York, Paris and Tokyo, as key to success.”
Read more: London’s most crowded tube lines revealed
He added: “Prime rents in luxury shopping destinations, New Bond Street being a key example, have held up relatively well despite the political uncertainty the UK has endured recently, as the prestige and attraction of global luxury brands remains unsullied.”
London took the top seven slots for the priciest shopping destinations in the UK, Followed by Glasgow, Manchester, Leeds, Newcastle and Edinburgh.
Main image credit: Getty


It looks like undertanding what a monad is will require some time
For this part I'll just copy/paste some things I found on the internet, and leave the learning for the future
A monad acts as a container that abstracts details about a computation, and let us focus more on what we want to do with the contained values.
Example of monads depending on a detail of a computation:
A monad define operations to work on that container
Example of operations:
Return
In Haskell, return wraps the value inside a monad of the context (IO) Note: $ = Function application (($) :: (a -> b) -> a -> b)
simpleTwice :: String -> String
simpleTwice word = word ++ " " ++ word
monadicTwice :: String -> IO String
monadicTwice word = return $ simpleTwice word
Fmap
It pulls out the value, the value is used somewere, it puts the value back in the monad
upper :: String -> String
upper = map toUpper
maybeValue :: Maybe String
maybeValue = return "Hello"main :: IO ()
main =
print alsoMaybeValue
where
alsoMaybeValue = fmap upper maybeValue
Join
if a = Just (Just 'a') then join a = Just 'a'
Prelude Control.Monad> let a = Just (Just "Hello")
Prelude Control.Monad> a
Just (Just "Hello")
Prelude Control.Monad> join a
Just "Hello"
Bind
Basically combining fmap and join
Prelude> let makeMaybe x = Just x
Prelude> let maybeDouble x = Just (x + x)
Prelude> fmap maybeDouble (makeMaybe 10)
Just (Just 20)
Prelude> makeMaybe 10 >>= maybeDouble
Just 20
LiftM
monadicValueA = Just 20
monadicValueB = Just 30
add :: Int -> Int -> Int
add x y = x + y
monadicAdd :: Maybe Int -> Maybe Int -> Maybe Int
monadicAdd = liftM2 add
main :: IO ()
main = print $ monadicAdd monadicValueA monadicValueB
Monadic compose
f1 :: Int -> Maybe String
f1 x
| x > 10 = Just "I have a hat!"
| otherwise = Nothing
equalsA :: Char -> Bool
equalsA c = c == 'a'
f2 :: String -> Maybe Bool
f2 str = Just $ any equalsA str
f3 :: Int -> Maybe Bool
f3 = f1 >=> f2
main :: IO ()
main = print $ f3 20


Frankie's Cupcakes
established 2016
Our Cupcakes
Chocolate Chunk
Strawberry Cheesecake
Vanilla Cream
Cinnamon Roll
Birthday Cake
Carrot Cake


Hello, my name is João Machado.
And in the last 2 years I made a 180º turn to my goal. I lost my job for years and decided to put into practice one of my interests, I started to study programming.
I currently work in the IT field, and I love what I do.

Well, this is a little summary, about me.
Do not hesitate to contact me if you need to know more about me.


🖊 Edit Details
⭕ Delete Campaign
Campaign Short Description
Challenge Rating
Classification
Campaign Description
TextHere


create an account with lodgeNg.com by clicking on the register button and filling in your details on the form.
Then log-in with your account details [email & password] or with your facebook account.
Then find a lodge of your choice,view the details and click on paynow button if you wish to book the lodge
LodgeNg.com only accept online payment gateway using your verve, visa or mastercard.


Money Play. How should Red play 51?
pips Red=155 White=147
(CorrectAnswer= 0/0, ErrorScore= 0)
Bar/24, 13/8 is safe but leaves Red looking a poor second.
Now is the time to take a risk with White having only 9 checkers in the attack zone. The correct play is bar/20, 24/23. If you take a checker from White’s mid-point and put it on his 8-pt then the two plays are equal in equity. As it stands bar/24, 13/8 is an error.
Now is the time to take a risk with White having only 9 checkers in the attack zone. The correct play is bar/20, 24/23. If you take a checker from White’s mid-point and put it on his 8-pt then the two plays are equal in equity. As it stands bar/24, 13/8 is an error.
1. Cubeful 2-ply bar/20 24/23 Eq.: -0.429 0.404 0.107 0.005 - 0.596 0.233 0.008 2. Cubeful 2-ply bar/24 13/8 Eq.: -0.444 (-0.015) 0.395 0.110 0.004 - 0.605 0.204 0.011 3. Cubeful 2-ply bar/24 6/1* Eq.: -0.548 (-0.120) 0.380 0.105 0.003 - 0.620 0.226 0.017 4. Cubeful 2-ply bar/24 8/3 Eq.: -0.553 (-0.124) 0.371 0.103 0.003 - 0.629 0.215 0.014 5. Cubeful 0-ply bar/20 6/5 Eq.: -0.708 (-0.279) 0.366 0.092 0.005 - 0.634 0.289 0.019


Shoot for the moon, even if you miss, you will still land on the star.
All the glory of life, to the end of the lonely repayment.
The essence of one's suffering is the anger to his disablement.


|
|
| Hdf5Context (const Hdf5Context &ctx) |
| |
|
Hi5Tree & | getMyHi5 (h5_role::value_t filter=(CARTESIAN|POLAR|INPUT|CURRENT)) |
| | Pointer to the last HDF5 structure in Cartesian coordinates: input or Cartesian product.
|
| |
| Hi5Tree & | getHi5 (h5_role::value_t filter) |
| | Derives the most relevant polar data (input or product) and returns it. More...
|
| |
| Hi5Tree & | getCartesianHi5 (h5_role::value_t filter=(PRIVATE|SHARED)) |
| | Derives the most relevant polar input data and returns it. More...
|
| |
|
Hi5Tree & | getCurrentInputHi5 (h5_role::value_t filter=(PRIVATE|SHARED)) |
| |
|
|
static const h5_role::value_t | CURRENT = h5_role::add("CURRENT") |
| |
|
static const h5_role::value_t | INPUT = h5_role::add("INPUT") |
| |
|
static const h5_role::value_t | POLAR = h5_role::add("POLAR") |
| |
|
static const h5_role::value_t | CARTESIAN =h5_role::add("CARTESIAN") |
| |
|
static const h5_role::value_t | EMPTY = h5_role::add("EMPTY") |
| |
|
static const h5_role::value_t | PRIVATE = h5_role::add("PRIVATE") |
| |
|
static const h5_role::value_t | SHARED = h5_role::add("SHARED") |
| |
◆ getCartesianHi5()
| Hi5Tree& getCartesianHi5 |
( |
h5_role::value_t |
filter = (PRIVATE|SHARED) | ) |
|
|
inline |
Derives the most relevant polar input data and returns it.
Returns in order of priority:
local, if non-empty
shared, if non-empty
local (empty)
◆ getHi5()
| Hi5Tree & getHi5 |
( |
h5_role::value_t |
filter | ) |
|
Derives the most relevant polar data (input or product) and returns it.
Returns in order of priority:
local, if non-empty
shared, if non-empty
local (empty)
◆ updateHdf5Status()
Split what:source to separate fields
◆ cartesianHi5
Flag for marking the origin of polarHi5.
A single-radar Cartesian product or a multi-radar composite (mosaic).
◆ currentPolarHi5
Pointer to the last HDF5 structure in polar coordinates: input volume or polar product.
The data pointed to will be applied as input to a Cartesian product (single-radar or composite).
The documentation for this class was generated from the following files:


| I l@ve RuBoard |
Although the Version 2.0 specification clarifies a lot of questions that were left open in the 1.0 version, there are still some remaining issues:
Define a useful return value for .nextset() for the case where a new result set is available.
Create a fixed point numeric type for use as loss-less monetary and decimal interchange format.
| I l@ve RuBoard |


{% load static %}
Careful. The project is in alpha testing stage. Your data may be lost at any time.
This is a social network. It's called "640Kb ought to be enough for anyone". Each user have only 640Kb for his personal purpose. Use Resources Wisely.


Documentation / Introduction / EbeanServer
EbeanServer
The EbeanServer provides almost all of the functionality including queries
, saving
, deleting
and transactions
. It effectively provides all the functionality.
A EbeanServer instance maps to a single database - there is effectively a one to one mapping of EbeanServer instance to database. If our application talks to many databases we can have many EbeanServer instances each with a unique name.
Applications that only use a single database only have one instance of EbeanServer.
// save customer to the database
Customer customer = ...
ebeanServer.save(customer);
// fetch some customers from the database
List<Customer> customers =
ebeanServer.find(Customer.class)
.where().eq("status", Customer.Status.NEW)
.findList();
Default EbeanServer
We can define one of the EbeanServer instances to be the default EbeanServer. This is the main or primary EbeanServer instance that the application uses.
Many applications only talk to one database and in that case there is only one EbeanServer instance and it is also the default server.
Ebean
- Holds a registry of EbeanServer instances (keyed by name)
- Holds one EbeanServer instance known as the default server
- Has convenience methods to operate on the default server
Obtain the default EbeanServer
When an EbeanServer instance is created it is registered with Ebean. We can use Ebean
to obtain those
EbeanServer instances by name and we can obtain the default server via Ebean.getDefaultServer()
.
// obtain the "default" server
EbeanServer server = Ebean.getDefaultServer();
Obtain a EbeanServer instance by name
When there are many EbeanServer instances they are registered with Ebean with a name
and we can use that
to obtain them via Ebean.
// obtain the HR server by name
EbeanServer hrServer = Ebean.getServer("hr");
Convenience methods
Ebean has static convenience methods that proxy through to the default server.
Customer customer = ...
// save customer to the database
// using the 'default' ebeanServer
Ebean.save(customer);
// which is the same as
EbeanServer defaultServer = Ebean.getDefaultServer()
defaultServer.save(customer);
Ebean is optional
Note that you don't have to use the Ebean singleton in your application at all - it's use is completely optional.
Instead we can create the EbeanServer instance(s) and inject
them where needed - we typically do this
using Spring
or Guice
or a similar DI framework.
When we do this (inject EbeanServer and don't use the Ebean singleton) we will likely have the application code following a DI / Repository pattern convention.
Global state
The Ebean singleton has static methods which refer to the default server and we could reasonably say this represents global state. Generally this is considered bad for testing.
Ebean provides support for mocking the EbeanServer API even when accessed via the Ebean singleton using Mocki Ebean.
Also note that the database itself represents global state and from a testing perspective there are many reasons to run tests against the same database platform (Postgres, MySql, Oracle etc) that we are targeting in production. We can do this nicely using docker.
Model and Finder
Due to the way we can access the default server via the Ebean singleton - a coding style / approach has
evolved that uses io.ebean.Model
and io.ebean.Finder
to provide an active record
style approach.
We discuss the option of using Model and Finder in more detail at coding style options.


hello guy's
i'm new to energy monitoring
I bought 3 emontx v.2 and rfm12pi and it works really well, thank you!
I am currently studying the possibility of expanding my system and use the raspberry pi for reading additional 4 ct with analog to digital converter (MCP3008) and a python script but the knowledge that I have in programming are intermediate level and I need to adapt the calcIrms of emonlib in my python script
if someone could take a look and give me ideas
this is a arduino emonlib
double EnergyMonitor::calcIrms(int NUMBER_OF_SAMPLES)
{
#if defined emonTxV3
int SUPPLYVOLTAGE=3300;
#else
int SUPPLYVOLTAGE = readVcc();
#endif
for (int n = 0; n < NUMBER_OF_SAMPLES; n++)
{
lastSampleI = sampleI;
sampleI = analogRead(inPinI);
lastFilteredI = filteredI;
filteredI = 0.996*(lastFilteredI+sampleI-lastSampleI);// Root-mean-square method current
// 1) square current values
sqI = filteredI * filteredI;
// 2) sum
sumI += sqI;
}double I_RATIO = ICAL *((SUPPLYVOLTAGE/1000.0) / 1023.0);
Irms = I_RATIO * sqrt(sumI / NUMBER_OF_SAMPLES);//Reset accumulators
sumI = 0;
//--------------------------------------------------------------------------------------return Irms;
}
and this is a part of my python script
SPICLK = 18
SPIMISO = 23
SPIMOSI = 24
SPICS = 25# set up the SPI interface pins
GPIO.setup(SPIMOSI, GPIO.OUT)
GPIO.setup(SPIMISO, GPIO.IN)
GPIO.setup(SPICLK, GPIO.OUT)
GPIO.setup(SPICS, GPIO.OUT)# mcp3008 input
votage_Supply = 0;
ct1_adc = 1;
ct2_adc = 2;
ct3_adc = 3;
ct4_adc = 4;# read the analog pin
ct1 = readadc(ct1_adc, SPICLK, SPIMOSI, SPIMISO, SPICS)
if someone could take a look and give me ideas
Re: Raspberry pi ,mcp3008, and python script substitue to emontx ?
Thats a nice idea! without knowing much about your exact setup would just adapting the calcIrms code like this work:
import math
SPICLK = 18
SPIMISO = 23
SPIMOSI = 24
SPICS = 25
# set up the SPI interface pins
GPIO.setup(SPIMOSI, GPIO.OUT)
GPIO.setup(SPIMISO, GPIO.IN)
GPIO.setup(SPICLK, GPIO.OUT)
GPIO.setup(SPICS, GPIO.OUT)
# mcp3008 input
votage_Supply = 0;
ct1_adc = 1;
ct2_adc = 2;
ct3_adc = 3;
ct4_adc = 4;
NUMBER_OF_SAMPLES = 1000
SUPPLYVOLTAGE = 3300
ICAL = 111.1
sumI = 0
sampleI = 512
filteredI = 0
for n in range (0, NUMBER_OF_SAMPLES):
lastSampleI = sampleI
# read the analog pin
sampleI = readadc(ct1_adc, SPICLK, SPIMOSI, SPIMISO, SPICS)
lastFilteredI = filteredI
filteredI = 0.996*(lastFilteredI+sampleI-lastSampleI)
sqI = filteredI * filteredI
sumI += sqI
I_RATIO = ICAL * ((SUPPLYVOLTAGE/1000.0) / 1023.0)
Irms = I_RATIO * math.sqrt(sumI / NUMBER_OF_SAMPLES)
sumI = 0
print Irms
Re: Raspberry pi ,mcp3008, and python script substitue to emontx ?
Thanks you very much !!! :-)
Re: Raspberry pi ,mcp3008, and python script substitue to emontx ?
This is my final working python script for energy monitoring direct on the raspberry pi with the mcp3008
#!/usr/bin/env python
# just some bitbang code for testing all 8 channels
import math
import RPi.GPIO as GPIO, time, os
import urllib2
import time
apike = "yourapikey"
emoncmspath = "<IP_ADDRESS>/emoncms"
interval = 20 # 20 sec
DEBUG = 1
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# this function is not used, its for future reference!
def slowspiwrite(clockpin, datapin, byteout):
GPIO.setup(clockpin, GPIO.OUT)
GPIO.setup(datapin, GPIO.OUT)
for i in range(8):
if (byteout & 0x80):
GPIO.output(datapin, True)
else:
GPIO.output(datapin, False)
byteout <<= 1
GPIO.output(clockpin, True)
GPIO.output(clockpin, False)
# this function is not used, its for future reference!
def slowspiread(clockpin, datapin):
GPIO.setup(clockpin, GPIO.OUT)
GPIO.setup(datapin, GPIO.IN)
byteout = 0
for i in range(8):
GPIO.output(clockpin, False)
GPIO.output(clockpin, True)
byteout <<= 1
if (GPIO.input(datapin)):
byteout = byteout | 0x1
return byteout
# read SPI data from MCP3008 chip, 8 possible adc's (0 thru 7)
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
if ((adcnum > 7) or (adcnum < 0)):
return -1
GPIO.output(cspin, True)
GPIO.output(clockpin, False) # start clock low
GPIO.output(cspin, False) # bring CS low
commandout = adcnum
commandout |= 0x18 # start bit + single-ended bit
commandout <<= 3 # we only need to send 5 bits here
for i in range(5):
if (commandout & 0x80):
GPIO.output(mosipin, True)
else:
GPIO.output(mosipin, False)
commandout <<= 1
GPIO.output(clockpin, True)
GPIO.output(clockpin, False)
adcout = 0
# read in one empty bit, one null bit and 10 ADC bits
for i in range(12):
GPIO.output(clockpin, True)
GPIO.output(clockpin, False)
adcout <<= 1
if (GPIO.input(misopin)):
adcout |= 0x1
GPIO.output(cspin, True)
adcout /= 2 # first bit is 'null' so drop it
return adcout
# change these as desired
SPICLK = 18
SPIMISO = 23
SPIMOSI = 24
SPICS = 25
# set up the SPI interface pins
GPIO.setup(SPIMOSI, GPIO.OUT)
GPIO.setup(SPIMISO, GPIO.IN)
GPIO.setup(SPICLK, GPIO.OUT)
GPIO.setup(SPICS, GPIO.OUT)
# Note that bitbanging SPI is incredibly slow on the Pi as its not
# a RTOS - reading the ADC takes about 30 ms (~30 samples per second)
# which is awful for a microcontroller but better-than-nothing for Linux
#RMS calcule fonction
def CalcIrms(cts):
NUMBER_OF_SAMPLES = 1000
SUPPLYVOLTAGE = 3300
ICAL = 111.1
sumI = 0
sampleI = 512
filteredI = 0
for n in range (0, NUMBER_OF_SAMPLES):
lastSampleI = sampleI
sampleI = readadc(cts, SPICLK, SPIMOSI, SPIMISO, SPICS)
#print sampleI
lastFilteredI = filteredI
filteredI = 0.996*(lastFilteredI+sampleI-lastSampleI)
sqI = filteredI * filteredI
sumI += sqI
I_RATIO = ICAL * ((SUPPLYVOLTAGE/1000.0) / 1023.0)
Irms = I_RATIO * math.sqrt(sumI / NUMBER_OF_SAMPLES)
sumI = 0
return Irms
# mcp3008 input
ct1_adc = 0
ct2_adc = 1
ct3_adc = 2
ct4_adc = 3
# Convert the reading value in RMS
# ct1 and ct2 monitor my 2 pole 240v main power
while True:
ct1 = CalcIrms(ct1_adc)*120 #ct1 and ct2 are added by emoncms
ct2 = CalcIrms(ct2_adc)*120
ct3 = CalcIrms(ct3_adc)*240
ct4 = CalcIrms(ct4_adc)*240
#print "ct1: %.2f watt" % ct1
#print "ct2: %.2f watt" % ct2
#print "ct3: %.2f watt" % ct3
#print "ct4: %.2f watt" % ct4
urllib2.urlopen("http://"+emoncmspath+"/input/post.json?node=8&csv="+str(ct1)+","+str(ct2)+","+str(ct3)+","+str(ct4)+ "&apikey=" + apike)
time.sleep(interval)
Re: Raspberry pi ,mcp3008, and python script substitue to emontx ?
some pic of my system
breadboard
Raspberry pi case
Outside module connected to raspberry pi
the raspberry pi are in my garage because the distribution board is in, and my interior finish is metal sheet , for this reason i put the rfm12pi outside with the sensors
the mcp3008 measure main power and 2 complete circuit
and i have 3 emontx inside home
Re: Raspberry pi ,mcp3008, and python script substitue to emontx ?
@jmg22 Thank you very much for sharing. I actually want to do this as well but connecting a CT Sensor to the MCP3008. Do you have a circuit diagram?
Re: Raspberry pi ,mcp3008, and python script substitue to emontx ?
Sampling with a rate as low as that is nearly useless for correct RMS calculations. If 'undersampling' is unavoidable than the sampling periode has to be exact and in an absolutely fixed relation to the signal frequency. This has been discussed a lot of times already.
And I would use an MCP3208 as the added two bits in resolution do not cost a fortune.
BR, Jörg.
Re: Raspberry pi ,mcp3008, and python script substitue to emontx ?
Hi can you post your circuit? I have some problems to understand how it work!
how i cal calc i icall value (111.1)?
regards Paolo
Re: Raspberry pi ,mcp3008, and python script substitue to emontx ?
How the calibration values are calculated is all in Building Blocks.
Re: Raspberry pi ,mcp3008, and python script substitue to emontx ?
Do you have the circuit diagram? Ragards paolo


?"V*
Vo
V"
80“ÈN|CAL
V''"
OET.
RICHARD
A.
HOWARD
1978
no
3d
ff
PƒRE
DUSS
HERBIER
DE
LA
GUADELOUPE
Ç-^ra^tA-c
ñ&C-
New
York
Botanical
Garden
lb5241b
'31*
^CAXidUKlUM
hookeri
Determined
by
Thomas
ClTO‰t
^
^_
Missouri
Botanical
Garden
Anthurium
acaule
(Jacq.)
Schott
*
1622496
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


|
STM8S Standard Peripheral Libary
2.2.0
|
Macros used by the assert function in order to check the different functions parameters. More...
Macros | |
| #define | IS_FLASH_PROG_ADDRESS_OK(ADDRESS) |
| Macro used by the assert function in order to check the different sensitivity values for the flash program Address. More... | |
| #define | IS_FLASH_DATA_ADDRESS_OK(ADDRESS) |
| Macro used by the assert function in order to check the different sensitivity values for the data eeprom Address. More... | |
| #define | IS_FLASH_ADDRESS_OK(ADDRESS) |
| Macro used by the assert function in order to check the different sensitivity values for the data eeprom and flash program Address. More... | |
| #define | IS_FLASH_PROG_BLOCK_NUMBER_OK(BLOCKNUM) ((BLOCKNUM) < FLASH_PROG_BLOCKS_NUMBER) |
| Macro used by the assert function in order to check the different sensitivity values for the flash program Block number. | |
| #define | IS_FLASH_DATA_BLOCK_NUMBER_OK(BLOCKNUM) ((BLOCKNUM) < FLASH_DATA_BLOCKS_NUMBER) |
| Macro used by the assert function in order to check the different sensitivity values for the data eeprom Block number. | |
| #define | IS_MEMORY_TYPE_OK(MEMTYPE) |
| Macro used by the assert function in order to check the different sensitivity values for the flash memory type. More... | |
| #define | IS_FLASH_PROGRAM_MODE_OK(MODE) |
| Macro used by the assert function in order to check the different sensitivity values for the flash program mode. More... | |
| #define | IS_FLASH_PROGRAM_TIME_OK(TIME) |
| Macro used by the assert function in order to check the program time mode. More... | |
| #define | IS_FLASH_LOW_POWER_MODE_OK(LPMODE) |
| Macro used by the assert function in order to check the different sensitivity values for the low power mode. More... | |
| #define | IS_OPTION_BYTE_ADDRESS_OK(ADDRESS) |
| Macro used by the assert function in order to check the different sensitivity values for the option bytes Address. More... | |
| #define | IS_FLASH_FLAGS_OK(FLAG) |
| Macro used by the assert function in order to check the different flags values. More... | |
| #define | IS_FLASH_PROG_ADDRESS_OK(ADDRESS) |
| Macro used by the assert function in order to check the different sensitivity values for the flash program Address. More... | |
| #define | IS_FLASH_DATA_ADDRESS_OK(ADDRESS) |
| Macro used by the assert function in order to check the different sensitivity values for the data eeprom Address. More... | |
| #define | IS_FLASH_ADDRESS_OK(ADDRESS) |
| Macro used by the assert function in order to check the different sensitivity values for the data eeprom and flash program Address. More... | |
| #define | IS_FLASH_PROG_BLOCK_NUMBER_OK(BLOCKNUM) ((BLOCKNUM) < FLASH_PROG_BLOCKS_NUMBER) |
| Macro used by the assert function in order to check the different sensitivity values for the flash program Block number. | |
| #define | IS_FLASH_DATA_BLOCK_NUMBER_OK(BLOCKNUM) ((BLOCKNUM) < FLASH_DATA_BLOCKS_NUMBER) |
| Macro used by the assert function in order to check the different sensitivity values for the data eeprom Block number. | |
| #define | IS_MEMORY_TYPE_OK(MEMTYPE) |
| Macro used by the assert function in order to check the different sensitivity values for the flash memory type. More... | |
| #define | IS_FLASH_PROGRAM_MODE_OK(MODE) |
| Macro used by the assert function in order to check the different sensitivity values for the flash program mode. More... | |
| #define | IS_FLASH_PROGRAM_TIME_OK(TIME) |
| Macro used by the assert function in order to check the program time mode. More... | |
| #define | IS_FLASH_LOW_POWER_MODE_OK(LPMODE) |
| Macro used by the assert function in order to check the different sensitivity values for the low power mode. More... | |
| #define | IS_OPTION_BYTE_ADDRESS_OK(ADDRESS) |
| Macro used by the assert function in order to check the different sensitivity values for the option bytes Address. More... | |
| #define | IS_FLASH_FLAGS_OK(FLAG) |
| Macro used by the assert function in order to check the different flags values. More... | |
Macros used by the assert function in order to check the different functions parameters.
| #define IS_FLASH_ADDRESS_OK | ( | ADDRESS | ) |
Macro used by the assert function in order to check the different sensitivity values for the data eeprom and flash program Address.
Definition at line 179 of file stm8s_flash.h.
| #define IS_FLASH_ADDRESS_OK | ( | ADDRESS | ) |
Macro used by the assert function in order to check the different sensitivity values for the data eeprom and flash program Address.
Definition at line 179 of file stm8s_flash.h.
| #define IS_FLASH_DATA_ADDRESS_OK | ( | ADDRESS | ) |
Macro used by the assert function in order to check the different sensitivity values for the data eeprom Address.
Definition at line 173 of file stm8s_flash.h.
| #define IS_FLASH_DATA_ADDRESS_OK | ( | ADDRESS | ) |
Macro used by the assert function in order to check the different sensitivity values for the data eeprom Address.
Definition at line 173 of file stm8s_flash.h.
| #define IS_FLASH_FLAGS_OK | ( | FLAG | ) |
Macro used by the assert function in order to check the different flags values.
Definition at line 242 of file stm8s_flash.h.
| #define IS_FLASH_FLAGS_OK | ( | FLAG | ) |
Macro used by the assert function in order to check the different flags values.
Definition at line 242 of file stm8s_flash.h.
| #define IS_FLASH_LOW_POWER_MODE_OK | ( | LPMODE | ) |
Macro used by the assert function in order to check the different sensitivity values for the low power mode.
Definition at line 218 of file stm8s_flash.h.
| #define IS_FLASH_LOW_POWER_MODE_OK | ( | LPMODE | ) |
Macro used by the assert function in order to check the different sensitivity values for the low power mode.
Definition at line 218 of file stm8s_flash.h.
| #define IS_FLASH_PROG_ADDRESS_OK | ( | ADDRESS | ) |
Macro used by the assert function in order to check the different sensitivity values for the flash program Address.
Definition at line 166 of file stm8s_flash.h.
| #define IS_FLASH_PROG_ADDRESS_OK | ( | ADDRESS | ) |
Macro used by the assert function in order to check the different sensitivity values for the flash program Address.
Definition at line 166 of file stm8s_flash.h.
| #define IS_FLASH_PROGRAM_MODE_OK | ( | MODE | ) |
Macro used by the assert function in order to check the different sensitivity values for the flash program mode.
Definition at line 203 of file stm8s_flash.h.
| #define IS_FLASH_PROGRAM_MODE_OK | ( | MODE | ) |
Macro used by the assert function in order to check the different sensitivity values for the flash program mode.
Definition at line 203 of file stm8s_flash.h.
| #define IS_FLASH_PROGRAM_TIME_OK | ( | TIME | ) |
Macro used by the assert function in order to check the program time mode.
Definition at line 210 of file stm8s_flash.h.
| #define IS_FLASH_PROGRAM_TIME_OK | ( | TIME | ) |
Macro used by the assert function in order to check the program time mode.
Definition at line 210 of file stm8s_flash.h.
| #define IS_MEMORY_TYPE_OK | ( | MEMTYPE | ) |
Macro used by the assert function in order to check the different sensitivity values for the flash memory type.
Definition at line 196 of file stm8s_flash.h.
| #define IS_MEMORY_TYPE_OK | ( | MEMTYPE | ) |
Macro used by the assert function in order to check the different sensitivity values for the flash memory type.
Definition at line 196 of file stm8s_flash.h.
| #define IS_OPTION_BYTE_ADDRESS_OK | ( | ADDRESS | ) |
Macro used by the assert function in order to check the different sensitivity values for the option bytes Address.
Definition at line 227 of file stm8s_flash.h.
| #define IS_OPTION_BYTE_ADDRESS_OK | ( | ADDRESS | ) |
Macro used by the assert function in order to check the different sensitivity values for the option bytes Address.
Definition at line 227 of file stm8s_flash.h.


--- layout: post date: 2012-05-21 time: "09:00:00" authors: ["Mike Hansen"] title: An Exercise With Matplotlib and Numpy tags: ["Tutorial"] ---
For this tutorial, we'll be plotting some weather data from a site call Weather Underground. You can download temperature readings and weather events for your local area in a comma-separated file.
I've put weather data for Bloomington, IN in a file called weather.csv. Each row is one day, and there are columns for min/mean/max temperature, dew point, wind speed, etc. We'll be plotting temperature and weather event data (e.g., rain, snow).
0. Installing matplotlib
I covered installing matplotlib in a previous tutorial. The matplotlib site also has installation instructions. I'll assume for the rest of the tutorial that you have matplotlib installed and working. If you can type this code at a Python shell:
from matplotlib import pyplot
and not receive any errors, then you're good to go.
1. Numpy Crash Course
The numpy module is how you do matrix-y stuff in Python. I'll give a quick example of why we'll need it. Imagine you were to type the following code into a Python shell:
x = [1, 2, 3, 4] print x * 5
What does this print? Why, this of course:
[1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
By default, the * operator in Python copies the contents of a list however many times you specify. So x * 5 copied the contents of x five times and stuck them all together.
When we're doing matrix math in Python, it would be nicer if x * 5 produced [5, 10, 15, 20]. We could do this manually with a loop:
for i in range(len(x)): x[i] = x[i] * 5
We could even get fancy with Python's list comprehension syntax:
x = [x_i * 5 for x_i in x]
For a list with only four elements, this won't be so bad. For larger lists, however, it will be quite slow. Using numpy avoids the performance hit by doing the heavy lifting in C instead of in Python. Here's how we'd do the previous example with numpy:
import numpy as np x = np.array([1, 2, 3, 4]) x = x * 5 print x
This prints array([ 5, 10, 15, 20]) which is what we would expect. The array(...) lets you know that x is a numpy array. Onward!
2. Reading the Data
As with many programming problems, our first step is to read the data into memory. I've started a script called plot_data.py with a few import statements and some utility functions. I'll explain these functions in detail as we go forward.
import numpy as np import matplotlib.pyplot as pyplot from datetime import datetime import os event_types = ['Rain', 'Thunderstorm', 'Snow', 'Fog'] num_events = len(event_types) def event2int(event): return event_types.index(event) def date2int(date_str): date = datetime.strptime(date_str, '%Y-%m-%d') return date.toordinal() def r_squared(actual, ideal): actual_mean = np.mean(actual) ideal_dev = np.sum([(val - actual_mean)**2 for val in ideal]) actual_dev = np.sum([(val - actual_mean)**2 for val in actual]) return ideal_dev / actual_dev
In past tutorials, we've either manually parsed our data file(s) or used Python's csv reader. Because of our focus on numpy here, we're going to use the loadtxt function. By passing in the right options, we can get loadtxt to parse our weather.csv file directly into a numpy array.
For a first pass, I've written the following function to read in the weather data:
def read_weather(file_name): data = np.loadtxt(file_name, delimiter=',', skiprows=1, converters = { 0 : date2int }, usecols=(0,1,2,3,21)) return data #-------------------------------------------------- data = read_weather('data/weather.csv') print data
The first two parameters, delmiter and skiprows tell loadtxt to split fields based on commas and skip the first row of the file (which contains column names). numpy doesn't handle dates, so I've used the converters parameter to have have loadtxt convert column 0 (a date string) into an integer using my date2int function. The last parameter, usecols, tells loadtxt to ignore all columns in the file except the first, second, third, forth, and twenty-second column (the date, temperature, and weather event columns).
Unfortunately, running this code produces the following error:
$ python plot_data.py Traceback (most recent call last): File "plot_data-2.py", line 34, in <module> data = read_weather("data/weather.csv") File "plot_data-2.py", line 28, in read_weather usecols=(0,1,2,3,21)) File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 796, in loadtxt items = [conv(val) for (conv, val) in zip(converters, vals)] ValueError: could not convert string to float: Rain
The final line tells us that numpy can't convert the string "Rain" into a floating point number. This is from the weather events column in our data, which contains text like "Rain" or "Snow-Fog". We could try and write a converter for this column too, but I've chosen to simply have numpy bring the column in as a string (which we'll manually parse later).
To do this, we pass in a special object for the dtype parameter of loadtxt. This object can be constructed by giving a dictionary to the numpy.dtype function. The code below provides names and data types for all of the columns we'll be using:
def read_weather(file_name): dtypes = np.dtype({ 'names' : ('timestamp', 'max temp', 'mean temp', 'min temp', 'events'), 'formats' : [np.int, np.float, np.float, np.float, 'S100'] }) data = np.loadtxt(file_name, delimiter=',', skiprows=1, converters = { 0 : date2int }, usecols=(0,1,2,3,21), dtype=dtypes) return data
The last column format is given as "S100", which means "string up to 100 characters in length." numpy needs to know the maximum size of the column for efficiency, so I gave myself plenty of room with 100 characters. Running this new code produces the following output:
$ python plot_data.py [(734503, 53.0, 43.0, 32.0, 'Rain') (734504, 32.0, 25.0, 18.0, 'Snow') (734505, 27.0, 20.0, 12.0, '') (734506, 42.0, 34.0, 26.0, '') (734509, 52.0, 40.0, 28.0, '') (734510, 47.0, 36.0, 24.0, '') (734511, 51.0, 38.0, 24.0, '') (734512, 57.0, 43.0, 28.0, '') (734513, 45.0, 43.0, 40.0, 'Rain') (734514, 43.0, 29.0, 15.0, 'Fog-Snow') (734515, 19.0, 17.0, 15.0, 'Snow') (734516, 27.0, 18.0, 9.0, 'Snow') ...
We're finally in business. Each row in our data set consists of a timestamp (the date converted to an integer), the maximum, mean, and minimum temperature, and the weather events that occurred that day. We're going to start by plotting the mean temperature versus the day of the year. Since we've given names to each of our columns, we can pull them out easily:
def read_weather(file_name): dtypes = np.dtype({ 'names' : ('timestamp', 'max temp', 'mean temp', 'min temp', 'events'), 'formats' : [np.int, np.float, np.float, np.float, 'S100'] }) data = np.loadtxt(file_name, delimiter=',', skiprows=1, converters = { 0 : date2int }, usecols=(0,1,2,3,21), dtype=dtypes) return data #-------------------------------------------------- data = read_weather('data/weather.csv') min_temps = data['min temp'] mean_temps = data['mean temp'] max_temps = data['max temp'] dates = [datetime.fromordinal(d) for d in data['timestamp']] events = data['events'] for date, temp in zip(dates, mean_temps): print '{0:%b %d}: {1}'.format(date, temp)
Each column can be extract individually from the data array by using data['column name']. I've used the datetime.fromordinal function on the timestamp column to convert the integers back into datetime objects.
Using the handy built-in zip function, I've printed out pairs of dates and mean temperatures. I use advanced string formatting to print the month, day, and temperature (see the datetime documentation for date formatting information). The program now gives the following output:
Jan 01: 43.0 Jan 02: 25.0 Jan 03: 20.0 Jan 04: 34.0 ... May 11: 59.0 May 12: 62.0 May 14: 69.0
Everything looks good, so let's get started plotting.
3. Temperature Plot
We're going to start with a simple line plot that has the day of the year on the x-axis and the mean temperature for that day on the y-axis. Our plotting function, called temp_plot, will take in dates and times, and give us back a matplotlib figure object. Here's the code:
def temp_plot(dates, mean_temps): year_start = datetime(2012, 1, 1) days = [(d - year_start).days + 1 for d in dates] fig = pyplot.figure() pyplot.title('Temperatures in Bloomington 2012') pyplot.ylabel('Mean Temperature (F)') pyplot.xlabel('Day of Year') pyplot.plot(days, mean_temps, marker='o') return fig
We start by computing the day of the year for each date. The datetime module lets us subtract dates from each other, producing a timedelta object. We subtract each date from January 1st of 2012, adding 1 so that our count will start from 1 instead of 0. The days field on a timedelta object gives the total number of days (in this case, from January 1st).
Next, we create a new matplotlib figure. In between calls to pyplot.figure, matplotlib's plotting functions will draw new plots on top of old ones. We'll use this fact to add a trend line to our plot shortly.
After adding a title and some axis labels to our figure, we call pyplot.plot with our days (x values) and mean_temps arrays (y values). I've also passed in 'o' to the optional marker parameter so that small circles will be plotted for each data point.
In the main body of the program, we use the os module to create a "plots" directory (checking if it exists first). Next, we call our temp_plot function and then use savefig to save the figure out to a png file:
data = read_weather('data/weather.csv') min_temps = data['min temp'] mean_temps = data['mean temp'] max_temps = data['max temp'] dates = [datetime.fromordinal(d) for d in data['timestamp']] events = data['events'] if not os.path.exists('plots'): os.mkdir('plots') fig = temp_plot(dates, mean_temps) fig.savefig('plots/day_vs_temp.png')
Running $ python plot_data.py should create a "plots" folder and put a file inside called "day_vs_temp.png" that looks like this:
Not bad! Let's add a trend line to the plot based on a simple linear model of the data.
3.1 Adding a trend line
By using numpy's polyfit function, adding a trend line is a snap. This function takes our x and y values (days and mean_temps), and gives us back a slope and intercept (the final parameter is the degree of the fitted polynomial — we pass 1 for a linear fit).
slope, intercept = np.polyfit(days, mean_temps, 1)
Using the slope and intercept, we can plot a trend line by computing "ideal" temperatures for each day according to the old y = mx + b formula. With our variables below, this will be ideal_temps = (slope * days) + intercept. Note that I've changed the days = ... line to days = np.array(...) so that we can do mathematical operations directly on the array.
def temp_plot(dates, mean_temps): year_start = datetime(2012, 1, 1) days = np.array([(d - year_start).days + 1 for d in dates]) fig = pyplot.figure() pyplot.title('Temperatures in Bloomington 2012') pyplot.ylabel('Mean Temperature (F)') pyplot.xlabel('Day of Year') pyplot.plot(days, mean_temps, marker='o') slope, intercept = np.polyfit(days, mean_temps, 1) ideal_temps = intercept + (slope * days) r_sq = r_squared(mean_temps, ideal_temps) fit_label = 'Linear fit ({0:.2f})'.format(slope) pyplot.plot(days, ideal_temps, color='red', linestyle='--', label=fit_label) pyplot.annotate('r^2 = {0:.2f}'.format(r_sq), (0.05, 0.9), xycoords='axes fraction') pyplot.legend(loc='lower right') return fig
To make the plot a little more useful, I've annotated the plot with the R-squared value of the fit. pyplot.annotate lets you put text on the figure in a variety of ways. Here, I've set the xycoords parameter to "axes fraction" so that annotate interprets my coordinates (0.05, 0.9) as fractions between 0 and 1 relative to the figure axes. The (0.05, 0.9) means to place the text horizontally 5% from the y-axis (left) and 90% from the x-axis (bottom).
The final call to pyplot.legend places a legend on the figure. You must include a label parameter on at least one plot object for this to work (I've included it on the trend line plot call). By default, the legend will show up in the upper-right corner of the figure. This will get in the way on our current plot, so I moved the figure to the lower-right with the loc parameter.
With the changes above, here's the new plot:
Notice that the string formatting ({0:.3f}) has rounded the R-squared value and slope label for us to three decimal places.
3.2 Adding "error" bars
Since we also have the min and max temperatures in our data, let's add "error" bars to our plot to show the temperature range on each day. We'll modify temp_plot to take in two additional parameters (min_temps and max_temps), and plot the temperature range if they both have values (i.e., are not None).
Adding error bars requires us to use the pyplot.errorbar function instead of pyplot.plot. It takes additional parameters (xerr and yerr) for the x and y errors. We will use yerr, and pass in an array with two rows: one for error above each data point, and one for the error below. This array is easily computed by subtracting the max and min temperatures from the mean, and then stacking the two arrays together row-wise with numpy.vstack.
def temp_plot(dates, mean_temps, min_temps = None, max_temps = None): year_start = datetime(2012, 1, 1) days = np.array([(d - year_start).days + 1 for d in dates]) fig = pyplot.figure() pyplot.title('Temperatures in Bloomington 2012') pyplot.ylabel('Mean Temperature (F)') pyplot.xlabel('Day of Year') if (max_temps is None or min_temps is None): # Normal plot without error bars pyplot.plot(days, mean_temps, marker='o') else: # Compute min/max temperature difference from the mean temp_err = np.row_stack((mean_temps - min_temps, max_temps - mean_temps)) # Make line plot with error bars to show temperature range pyplot.errorbar(days, mean_temps, marker='o', yerr=temp_err) pyplot.title('Temperatures in Bloomington 2012 (max/min)') slope, intercept = np.polyfit(days, mean_temps, 1) ideal_temps = intercept + (slope * days) r_sq = r_squared(mean_temps, ideal_temps) fit_label = 'Linear fit ({0:.2f})'.format(slope) pyplot.plot(days, ideal_temps, color='red', linestyle='--', label=fit_label) pyplot.annotate('r^2 = {0:2f}'.format(r_sq), (0.05, 0.9), xycoords='axes fraction') pyplot.legend(loc='lower right') return fig #-------------------------------------------------- data = read_weather('data/weather.csv') min_temps = data['min temp'] mean_temps = data['mean temp'] max_temps = data['max temp'] dates = [datetime.fromordinal(d) for d in data['timestamp']] events = data['events'] if not os.path.exists('plots'): os.mkdir('plots') # Plot without error bars fig = temp_plot(dates, mean_temps) fig.savefig('plots/day_vs_temp.png') # Plot with error bars fig = temp_plot(dates, mean_temps, min_temps, max_temps) fig.savefig('plots/day_vs_temp-all.png')
The new plot is saved to a file named day_vs_temp-all.png and looks like this:
If you need to compute standard error for your errorbar plot, you can use scipy.stats.sem from the scipy module.
For our next plot, we'll do a multi-part histogram of the weather events for each month.
4. Event Histogram
Histograms in matplotlib are generated using the pyplot.hist function. This function takes an array of data, which can itself contain arrays (for a multi-part histogram). We want to count events per month, so we'll need to create an array for each type of event. Inside these arrays will be observations like [1, 1, 2, 3, 3] for "January", "January", "February", "March", "March". Here's a diagram to help out:
When pyplot.hist receives our data, it will attempt to "bin" the month observations automatically. By default, it will break observations into 10 bins. We want a bin for each month instead, and we want the bins aligned properly to the month numbers (1 = January, 2 = February, etc.). The bins parameter to pyplot.hist takes either a number (representing the desired number of bins) or a sequence (representing the desired bin edges). In the code below, we pass range(1, 5 + 2) to ensure that our bins start at 1 (for January) and go through 5 (for May).
def hist_events(dates, events): event_months = [] for i in range(num_events): event_months.append([]) # Build up lists of months where events occurred for date, event_str in zip(dates, events): if len(event_str) == 0: # Skip blank events continue month = date.month # Multiple events in a day are separated by '-' for event in event_str.split('-'): event_code = event2int(event) event_months[event_code].append(month) # Plot histogram fig = pyplot.figure() pyplot.title('Weather Events in Bloomington 2012') pyplot.xlabel('Month') pyplot.ylabel('Event Count') bins = np.arange(1, 5 + 2) pyplot.hist(event_months, bins=bins, label=event_types) pyplot.legend() return fig
The main body of the program is updated to call hist_events and save the resulting figure to plots/event_histogram.png.
data = read_weather('data/weather.csv') min_temps = data['min temp'] mean_temps = data['mean temp'] max_temps = data['max temp'] dates = [datetime.fromordinal(d) for d in data['timestamp']] events = data['events'] if not os.path.exists('plots'): os.mkdir('plots') fig = temp_plot(dates, mean_temps) fig.savefig('plots/day_vs_temp.png') fig = temp_plot(dates, mean_temps, min_temps, max_temps) fig.savefig('plots/day_vs_temp-all.png') fig = hist_events(dates, events) fig.savefig(os.path.join('plots', 'event_histogram.png'))
When we run $ python plot_data.py, the new plot looks like this:
Each collection of bars represents a month, and the individual bars represent the number of Rain, Thunderstorm, etc. events observed for that month. The figure's legend was populated by passing event_types in for the label parameter of pyplot.hist.
The plot looks good, but it would be nice to properly label the months. We could do this manually with pyplot.xticks as follows:
pyplot.xticks( (1.5, 2.5, 3.5, 4.5, 5.5), ('January', 'February', 'March', 'April', 'May') )
This will label each bin in the center (hence the .5 added to each number) with the proper month name. If our data grows to include more months, however, we'll have to manually extend the number of bins and our labels. Let's change hist_events to keep track of the range of months in the data. Additionally, we'll use Python's calendar module to automatically get the month names.
At the top of the program, we'll import the calendar module:
import calendar
and then redefine hist_events as follows:
def hist_events(dates, events): event_months = [] for i in range(num_events): event_months.append([]) # Build up lists of months where events occurred min_month = 13 max_month = 0 for date, event_str in zip(dates, events): if len(event_str) == 0: # Skip blank events continue month = date.month min_month = min(month, min_month) max_month = max(month, max_month) # Multiple events in a day are separated by '-' for event in event_str.split('-'): event_code = event2int(event) event_months[event_code].append(month) # Plot histogram fig = pyplot.figure() pyplot.title('Weather Events in Bloomington 2012') pyplot.xlabel('Month') pyplot.ylabel('Event Count') pyplot.axes().yaxis.grid() num_months = max_month - min_month + 1; bins = np.arange(1, num_months + 2) # Bin edges pyplot.hist(event_months, bins=bins, label=event_types) # Align month labels to bin centers month_names = calendar.month_name[min_month:max_month+1] pyplot.xticks(bins + 0.5, month_names) pyplot.legend() return fig
During the process of building our observation arrays, we now track the minimum and maximum months observed. This allows us to automatically create our bin edges, and let's us grab months names from the calendar module by indexing into the calendar.month_name list.
Note that the bins variables was created using numpy.arange, which is a shortcut for bins = numpy.array(range(1, num_months + 2)). Making bins a numpy array lets us call pyplot.xticks with bins + 0.5, centering month_names on each bin.
As a bonus, I've also added a horizontal grid using the axis.grid function. You can add both a horizontal and vertical grid at the same time by calling pyplot.grid.
Here's the updated plot:
Looks ready for publication!


Queue adaptor, creates a queue using two Stacks left, right If there are at least two elements, left and right are not empty. More...
#include <queue.hpp>
Public Types | |
| using | container_type = Stack |
| using | value_type = typename Stack::value_type |
| using | size_type = typename Stack::size_type |
| using | reference = typename Stack::reference |
| using | const_reference = typename Stack::const_reference |
Public Member Functions | |
| const_reference | front () const |
| reference | front () |
| const_reference | back () const |
| reference | back () |
| bool | empty () const |
| size_type | size () const |
| void | push (const value_type &val) |
| void | pop () |
Protected Member Functions | |
| const auto & | get_left () |
| const auto & | get_right () |
Private Member Functions | |
| void | check_invariant () const |
Private Attributes | |
| Stack | left |
| Stack | right |
Queue adaptor, creates a queue using two Stacks left, right If there are at least two elements, left and right are not empty.
If there is one element, it is in left.
| using queue_tools::QueueAdaptor< Stack >::const_reference = typename Stack::const_reference |
| using queue_tools::QueueAdaptor< Stack >::container_type = Stack |
| using queue_tools::QueueAdaptor< Stack >::reference = typename Stack::reference |
| using queue_tools::QueueAdaptor< Stack >::size_type = typename Stack::size_type |
| using queue_tools::QueueAdaptor< Stack >::value_type = typename Stack::value_type |
|
inline |
|
inline |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
private |
|
private |


study
Bergin 2011
Cheng 2017
Zhang 2006
Zhao 2017
Overall (I-squared 96.7%, p 0.000)
P=0.000
NOTE: Weights are from random effects analysi
WMD (95% Cl)
3.30 (-5.14, -1.46)
-2.80 (3.01, -2.59)
-3.72 (-3.90, 3.54)
4.05 (~4.19, -3.91)
-3.51 (~4.15, -2.86)
Weight
881
30.08
30.43
30.69
100.00


The Prolog Engine is initialized by calling SP_initialize()
. This
must be done before any interface functions are called, except
those marked `preinit' in this manual.
The function will allocate data areas
used by Prolog, initialize command line arguments so that they can
be accessed by the argv
Prolog flag, and load the Runtime
Library.
To unload the SICStus emulator, SP_deinitalize()
can be called.
You may also call SP_force_interactive()
before calling
SP_initialize()
. This will force the I/O built-in
predicates to treat the standard input stream as a terminal, even
if it does not appear to be a terminal. Same as the -i option
in development systems (see Start).
You may also call SP_set_memalloc_hooks()
before calling
SP_initialize()
. This will define one layer of Prolog's
memory manager, in case your application has special requirements.
The SICStus Prolog memory manager has a two-layer structure. The top
layer has roughly the same functionality as the standard UNIX functions
malloc
and free
, whereas the bottom layer is an interface
to the operating system. It's the bottom layer that can be customized
by setting these hooks.


{% extends 'django_registration/base.html' %} {%load bootstrap4 %} {% block content %}
Welcome to the Neighbourhood
Fill in the form below to create an account with us. It's free!
If you already have an account, click here to login


Home
Core
Favorites
Follow
Code Repositories
JavaScript
Loading ...
Add a page named 'index' to see something here.
© Jupiter IT - JavaScriptMVC Training and Support


Student's Activity Center acts as a lab of HUMAN PERFORMANCE and a hub of enormous extra-curricular and co-curricular activities. SAC has played a key role in grooming the everyday lives of MNNITian's cultivating and nurturing their extra-curricular talents. It seeks to develop qualities of leadership amongst students to foster a corporate life and to advance the general cause of the student body. The various activities of the SAC are coordinated by the student committees, captains, vice captains coordinators etc. Students are exposed to almost all the sports providing an active and vibrant extracurricular life. Since the time of its establishment SAC has striven to motivate the students to be a good leader and a good human being.
All the activities are run under the administration of the President SAC, faculty co-ordinators, dy.co- ordinators in coordination with the sports officer and a team of student’s committees, captains, vice-captains and various other students’ co-ordinators.


---
layout: pages
---
ABOUT
Salutation,
Name - Arpan Biswas
Age - 15+
status - Single
Apart from this, i am an introvert School Student and a Self-Taught Learner. I spare most of the time learning my academic books ( i.e history and civics, mathametics etc )
and all the other boring staffs that are taught in school. In leisure, i like spending time with my brother, watch movies and anime series, play games and reading some off topic books from time to time.
I am always in a mod of finding, creating and innovating new and creative staffs related to open source.
I have keen interest in learning about the daily opensource creation around the world.


Use the Publish Settings page to control the way a template/profile appears in an implementation guide.
You can control the following:
- Generate and customize code samples to associate with the template.
- Control whether one or more constraints has its own heading in the implementation guide.
View the Publish Settings page
Select Publish Settings from the Template Viewer's Quick Buttons.
Constraint Headings
In some cases, a template/profile structure may be complicated enough that you want to document certain elements of the template/profile in greater detail.
Use the Constraints tab of the Publish Settings page to add headings to constraints that appear in an implementation guide. This allows complex templates to be broken into sections within the implementation guide.
Add a Heading to a Constraint
- In the Constraints section of the Publish Settings page, select Edit for the constraint you want to edit.
- To add to the constraint heading text, select the Heading check box. The Heading Description box appears.
- Enter text in the Heading Description, Description, and Label boxes. The text appears as shown in the example below.
- To add an inline code sample, select Add. The Edit Constraint Sample window appears. Enter a Name for the sample, and enter the sample code in the Sample Contents box, then select OK. The sample name appears in the sample list.
- When finished, select OK. Heading text, Description text, Label text, and Sample Code are added to the selected constraint. The effect is shown below.
- Remember to Save in the Edit Publish Settings page when finished.
Samples
Use the Template Samples tab of the Publish Settings page to generate, customize, and format code samples to associate with a particular template.
Generate a Code Sample
- In the Template Samples tab, select Add. The Edit Sample page appears.
- Enter a Name for the sample.
- Enter or paste the text you want to use in the sample, or select Generate to create a code sample based on the template's constraints.
- If you generated a sample, edit it as needed.
- To format the sample automatically, applying standard indentation, Format and Indent.
- When finished, select OK. The sample is saved, and is available for export with the implementation guide.


- receiverPieceID - Variable in class gameplay.logic.Attack
-
- Recruit - Class in gameplay.gameboard
-
Recruit is a own lightweight unit class for avoiding conflicts with the unit class.
- Recruit(UnitType) - Constructor for class gameplay.gameboard.Recruit
-
Sets up recruit with a UnitType, and also set images and styles of Recruit.
- recruit - Variable in class gameplay.gameboard.RecruitTile
-
- recruitContentXPadding - Variable in class gameplay.GameMain
-
- RecruitTile - Class in gameplay.gameboard
-
Own lightweight version of Tile for use in placementphase for holding recruits.
- RecruitTile(int, int, Recruit) - Constructor for class gameplay.gameboard.RecruitTile
-
Sets a recruit in the RecruitTile class, and creates a rectangle with the sizeX, and sizeY
an adds both recruit and rectangle as children to the stackpane.
- recruitUnits - Static variable in class gameplay.GameMain
-
- recruitXPadding - Variable in class gameplay.GameMain
-
- recruitYPadding - Variable in class gameplay.GameMain
-
- rect - Variable in class gameplay.gameboard.RecruitTile
-
- rect - Variable in class gameplay.gameboard.Tile
-
- releaseConnection(Connection) - Method in class database.ConnectionPool
-
Puts the connection back into the connectionPool after usage.
- removePlaceUnitLabel() - Static method in class gameplay.GameMain
-
Method for removing placeUnitLabel and arrow after first unit is added to the board
- removeUnit() - Method in class gameplay.gameboard.Tile
-
Removes a unit from the tile's StackPane and sets the unit=null;
- resourceLabel - Static variable in class gameplay.GameMain
-
- resources - Variable in class menus.controller.GameInfoController
-
- resources - Variable in class menus.controller.LoginController
-
- resources - Variable in class menus.controller.MainMenuController
-
- resources - Variable in class menus.controller.MatchSetupController
-
- resources - Variable in class menus.controller.SignUpController
-
- rollBack(Connection) - Static method in class database.Cleaner
-
Rollback changes if error occurs, this method has to be called upon
in a finally block.
- root - Static variable in class gameplay.GameMain
-
- rootScene - Static variable in class menus.Main
-
- rows - Variable in class gameplay.gameboard.Grid
-
- RunnableInterface - Interface in runnables
-
- runnables - package runnables
-


data class AccountId
Data class to hold account id |
|
data class ApiResult : ApiResultInterface
Json mapping of the result data from the Payment Highway API |
|
data class ApiResultInfo
Result info from Payment Highway API |
|
interface ApiResultInterface |
|
data class CardData
Data class to hold card info |
|
data class EncryptionKey
Data class to hold encryption key |
|
data class ExpiryDate
Data class to hold expiry data |
|
data class MerchantId
Data class to hold merchant id |
|
data class PaymentConfig
Payment Highway configuration |
|
data class TransactionId
Data class to hold transaction id |


This project aimed to validate the MOD16 evapotranspiration (ET) product, which is generated from MODIS data using an algorithm developed by Mu et al. (2011). I studied its accuracy at sites in Canada's boreal forest. ET is measured directly at flux tower sites, of which I have selected eight that are mapped below:
While the above map shows the ET product for all of 2014, I am comparing the MOD16 8-day products to flux tower measurements. Data for the selected flux towers is available in CSV format, gathered from http://ameriflux.lbl.gov. To compare MOD16 estimates to flux tower measurements of ET, I developed a python module that geoprocesses the MOD16 rasters and fills gaps in the flux tower measurements. Comparison is then made via time-series graphs and linear regression. The code below displays how the MOD16 rasters are bulk-downloaded. In this example, all the MOD16 raster files that cover a selected tower (CA-Qcu in the above map) are downloaded.
from bs4 import BeautifulSoup
import requests
class download_modis:
'''
this class downloads modis data
the __init__ function takes a list of years and a list of julian days
julian days should be strings and should have three digits, with leading
zeros if jd < 100
years can be int or str
the function can be applied to one tile at a time
it returns the tile folder where all the new rasters were saved
'''
def __init__(self, years, days, tile, out_folder):
self.years = years
self.days = days
self.tile = tile
self.out_folder = out_folder
def download_mod16(self):
#file type we want to download
ext = 'hdf'
base_url = r'http://files.ntsg.umt.edu'
for year in self.years:
for day in self.days:
url = r'http://files.ntsg.umt.edu/data/NTSG_Products/MOD16/MOD16A2.105_MERRAGMAO/Y{}/D{}/'.format(str(year), day)
page = requests.get(url).text
#parses the url's html file to find links to the rasters
soup = BeautifulSoup(page, 'html.parser')
#makes a list of the urls for the hdf files
files = [base_url + node.get('href') for node in soup.find_all('a') if node.get('href').endswith(ext)]
for file in files:
if file.split(".")[-4] == self.tile:
r = requests.get(file, allow_redirects = True)
#save file to outpath
tile_filepath = self.out_folder + r'\{}\{}'.format(self.tile, file.split("/")[-1])
open(tile_filepath, 'wb').write(r.content)
print("wrote to {}".format(tile_filepath))
@property
def mod16_folder(self):
return self.out_folder + r'\{}'.format(self.tile)
#Here are lines that show how I execute the code
#downloading rasters for h13v04 from 2004 to 2010
ca_qcu_years = [i for i in range(2004, 2011)]
#creates a list of the julian days that correspond to MOD16 8day periods
ca_qcu_days = [str(i).zfill(3) for i in range(1, 365, 8)]
#sets parameters needed to download the right files
ca_qcu_rasters = download_modis(ca_qcu_years, ca_qcu_days, "h13v04",
r'C:\Users\Devin Simmons\Desktop\GEOL393\figure_for_rd\gis_things\mod16_tiles')
#actually downloads these files
ca_qcu_rasters.download_mod16()
Next, I wrote a script to determine the MOD16 ET estimates for the selected flux towers. This invovled converting the MOD16 HDF files to rasters that could be processed in ArcPy, clipping these rasters to lie within a certain radius of the tower, and then averaging the values of the pixels left over after the clip occurred. The code sample below performs these geoprocessing actions at site CA-Qcu for the rasters that were downloaded earlier.
import arcpy
arcpy.env.overwriteOutput = True
class modis_et:
'''
initalization of the class requires a shapefile with flux towers, a tower name,
and an output folder
the tower in question is identified with the tower_name string.
tower_name should equal the towers fluxnetid
'''
def __init__(self, flux_towers, tower_name, output_env):
self.flux_towers = flux_towers
self.tower_name = tower_name
self.output_env = output_env
'''
buffer inputs should be floats and the units should be meters
this function buffers around the tower using the first_buffer, clips the
raster to the extent of the buffer
'''
def make_buffer(self, first_buffer):
self.first_buffer = first_buffer
#first this turns the tower shapefile into a layer
#then it selects the specified tower and makes a layer out of it
tower_layer = arcpy.MakeFeatureLayer_management(self.flux_towers, "tower_layer")
tower = arcpy.SelectLayerByAttribute_management(tower_layer, "NEW_SELECTION",
''' "fluxnetid" = '{}' '''.format(self.tower_name))
#makes a layer out of the chosen tower, buffers it, creates a shapefile of the buffer
arcpy.CopyFeatures_management(tower, self.output_env + r"/chosen_tower.shp")
tower = self.output_env + r"/chosen_tower.shp"
self.buffer_fc = self.output_env + r"/buffered_tower.shp"
arcpy.Buffer_analysis(tower, self.buffer_fc,
str(self.first_buffer) + " Meters")
'''
clips raster to the specified buffer for the flux tower
'''
def clip_raster(self, mod16_raster):
self.mod16_raster = mod16_raster
#this extracts the julian day the raster starts from the file name
#it looks better this way
self.julian_day = self.mod16_raster[9:16]
self.mod16_ET = self.output_env + r"/{}".format(self.julian_day + "ET.tif")
#extracts just the ET layer from the MOD16 hdf. this is located at index 0
arcpy.ExtractSubDataset_management(self.mod16_raster, self.mod16_ET, "0")
self.clipped_et = self.mod16_ET[0:-4] + "_clip.tif"
arcpy.Clip_management(self.mod16_ET,
'0 0 0 0', self.clipped_et,
self.buffer_fc, '#', "ClippingGeometry")
'''
returns mean et in millimeters
'''
@property
def mean_et(self):
mean = arcpy.GetRasterProperties_management(self.clipped_et, "MEAN")
return float(mean.getOutput(0))/10
#Here are lines that show how I execute the code
in_towers = r'C:\Users\Devin Simmons\Desktop\GEOL393\GIS\MOD16_2014_ET_Annual\flux_towers\fluxnet_sites\fluxnet_sites.shp'
in_rasters = r'C:\Users\Devin Simmons\Desktop\GEOL393\figure_for_rd\gis_things\mod16_tiles\h13v04'
out_folder = r"C:\Users\Devin Simmons\Desktop\GEOL393\figure_for_rd\gis_things\clip_features"
#performs analysis of rasters at CA-Qcu
test1 = modis_et(in_towers, "CA-Qcu", out_folder)
test1.make_buffer(1692)
#without these lines the program had trouble reading the HDF files
arcpy.env.workspace = in_rasters
rasters = arcpy.ListRasters("*", "HDF")
mod16_values = {}
#clips the raster to the tower, determines its ET value, adds the julian day
#that the 8 day period starts to a dictionary as a key with its ET value as the value
for raster in in_rasters:
test1.clip_raster(raster)
print("clipped " + raster)
mod16_values[test1.julian_day] = test1.mean_et
Next, the script processes the flux tower data CSVs and analyzes how MOD16 compares to the flux tower direct measures of ET. This process involves filling gaps in data and determining error, which requires hundreds of lines of code. As such, I will not include it in its entirety on this page, but I will show some snippets. The entirety of this code can be found on my github. Below is a figure that displays a linear regression of flux tower ET measurements compared to MOD16 estimates, made using matplotlib and analyzed with scipy. In addition, the necessary code is shown as well.
import flux_module
#csv with flux tower data, downloaded from ameriflux website
test_file = r"C:\Users\Devin Simmons\Desktop\GEOL393\flux_towers\figure_for_1st_pres\AMF_CA-Qcu_BASE_HH_1-1.csv"
#reads in the flux tower csv file
test_flux = flux_module.flux_reader(test_file)
test_flux.et_by_day()
#creates data dictionary that contains 8-day flux measurement periods that
#can be compared to MOD16 8-day period. range represents the range of
#years analyzed
test_flux.valid_8day_by_year([i for i in range(2004, 2011)])
#creates the linreg plot. mod16 values is the dictionary that is ultimately
#filled by instantiating the modis_et class, as shown above. flux tower values
#were generated in the line above
test_flux.linreg_et_plot(mod16_values, [i for i in range(2005, 2011)])
In addition, the flux_module has functions that make summary tables and time series graphs. Below is a time series and the code that created it:
import flux_module
#csv with flux tower data, downloaded from ameriflux website
test_file = r"C:\Users\Devin Simmons\Desktop\GEOL393\flux_towers\figure_for_1st_pres\AMF_CA-Qcu_BASE_HH_1-1.csv"
#reads in the flux tower csv file
test_flux = flux_module.flux_reader(test_file)
test_flux.et_by_day()
#gets data dictionary that contains 8-day flux measurement periods that
#can be compared to MOD16 8-day period. range represents the range of
#years analyzed
in_flux = test_flux.valid_8day_by_year([i for i in range(2004, 2011)])
#creates a time series plot for each year in the range 204 - 2010.
#mod16 values is the dictionary that is ultimately
#filled by instantiating the modis_et class, as shown above.
for i in range(2004, 2011):
test_flux.time_series_plot(in_flux, mod16_values, str(i))
plt.show()
plt.gcf().clear()
My ultimate hypothesis was to test whether MOD16 showed a longitudinal spatial variation in its accuracy. To determine MOD16 accuracy, I calculated three different its bias, percent bias, and root mean square error compared to the flux tower measurements of ET. I then plotted these measures compared to flux tower longitude and determined the correlation. There was no significant correlation between any of these measures and flux tower longitude. However, I then assessed MOD16 accuracy based on seasons, and found that there is a significant negative correlation between MOD16 bias/percent bias and longitude. This relationship is visualized below. Percent bias is an average of how "far off" MOD16 is from ground-measured values of ET for each 8-day period, as a proportion of the the measured ET value.


Tiny pluralization library in JavaScript that supports almost any language.
See it on GitHub →
!
See the code behind this page!
For more details, please, read the article: How to pluralize any word in different languages using JavaScript?


For more info on our Javascript SDK you can refer these links
Appacitive Ping Successful. Your app is up and running.
Appacitive.ping({
success: function(response) {
$('#divSuccess').show();
console.log(response);
},
error: function(error) {
$('#divError').html('Appacitive Ping Failed. Response: ' + error.message)
.show();
}
});


On the Manage access page, you can decide who is allowed to access a marketplace.
When a marketplace is created, it is public and accessible by any anonymous or registered users. You can restrict the access to it to the users of specific registered organizations. In this case, the users need to log in to be able to see, subscribe to, and use the services published on the marketplace. New customers cannot register themselves on the marketplace but need to be registered by a supplier, broker, reseller, or the platform operator.
If you turn a marketplace from a public into a non-public one, organizations with existing subscriptions or services published on the marketplace are automatically granted access to it. You can at any time revoke the access permission for each of these organizations in the same way as for organizations which were granted access explicitly. As a prerequisite, the organization's existing subscriptions must have been terminated and its services published on the marketplace must have been deactivated.
A marketplace with restricted access can at any time be made public again and thus accessible by any users and organizations.
To manage the access to a marketplace:


Mitchell Tilbrook
I'm Mobile and Web engineer in Syndey, Australia. I'm the Lead Android Engineer at Seatfrog a travel start-up here in Sydney. When I'm at work and developing a side project I like to have fun riding the motorbike, push-bike, or uni-cycle, walking thought the national parks around my house. When possible getting tougher with friends to have a game of Dungeon and Dragons.
Projects
I've become obsessed with working on RxJava for Android by kaushik I've even ported it to Kotlin also working on getting a set of Rx .NET.
Development
I also love learning new programing language right now I'm chewing on F#, Elixir, Kotlin.
Support or Contact
Twitter: @sir_tilbrook
Github: marukami