Day 18, Thursday, April 5, 2018

Complex Newton

Note: extent=(-r,r,-r,r) option in imshow.

Tartans for exploration of color and numpy fancy indexing

20180401_192723_tartan.jpg

Numpy boolean indexing

paper_weave.png

For the "mask: want patterns like this:

0 0 0 1 1 1 0 0 0 1 1 1 0 ...
1 0 0 0 1 1 1 0 0 0 1 1 1 ...
1 1 0 0 0 1 1 1 0 0 0 1 1 ...
1 1 1 0 0 0 1 1 1 0 0 0 1 ...
0 1 1 1 0 0 0 1 1 1 0 0 0 ...
0 0 1 1 1 0 0 0 1 1 1 0 0 ...
...

Threadcount and color info

You requested threadcount details from The Scottish Register of Tartans website
for the Argyll Campbell tartan. The details are given below.

Threadcount:
B4K4B36K40G36W8G36K40B34K6

Pallet:
B=2C4084BLUE;K=101010BLACK;G=005020MOD GREEN;W=E0E0E0WHITE;

Threadcount given over a half sett with full count at the pivots.

You may wish to refer to the threadcount guidance section
for further information on threadcounts.

Parsing the palette

Dictionaries

d = {'apple':'round crispy fruit', 'banana':'long yellow fruit'}
d['apple']
'round crispy fruit'

dictionary comprehensions

Conversion from hex strings to int

int('F8',16)

Exercise: make a color look-up table

Parsing the threadcount

Regular expressions

a pattern-matching syntax

import re
threadcount = 'B4K4B36K40G36W8G36K40B34K6'
colors = re.findall('[A-Z]' ,threadcount)
counts = re.findall('[0-9]+',threadcount)

Regular expressions are explored in more depth in MTH 448 Data-Oriented Computing for Mathematicians (Fall 2018).