This is the practical reference for cartel_engine.ts
(same file, same logic, also at
web-dashboard/src/cartel_engine.ts):
how to construct a world, drive it forward, and read the numbers back
out. For why the model behaves this way, see README.md.
flowchart TB
subgraph AWS["AWS Region: us-east-1"]
subgraph VPC["VPC: project-bedrock-vpc (10.0.0.0/16)"]
subgraph PublicSubnets["Public Subnets"]
subgraph PubSub1["Public Subnet AZ 1a<br/>10.0.1.0/24"]
NAT1["NAT Gateway"]
end
subgraph PubSub2["Public Subnet AZ 1b<br/>10.0.2.0/24"]
NAT2["NAT Gateway"]graph TB
subgraph "Input Layer"
A1[Remote Storage<br/>GCS Buckets]
A2[Local Files<br/>work_path]
end
subgraph "Configuration"
B[config.yaml<br/>Defines Steps & Tasks]
end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import numpy.linalg as la | |
| from readonly.PageRankFunctions import * | |
| np.set_printoptions(suppress=True) | |
| def pageRank(linkMatrix, d) : | |
| n = linkMatrix.shape[0] | |
| M = d * linkMatrix + (1-d)/n * np.ones([n, n]) # np.ones() is the J matrix, with ones for each entry. | |
| r = 100 * np.ones(n) / n # Sets up this vector (n entries of 1/n × 100 each) | |
| lastR = r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # print(loadFile('./Downloads/Vibrio_cholerae.txt', 'CTTGATCAT')) | |
| """ | |
| FindClumps(Text, k, L, t) | |
| Patterns ← an array of strings of length 0 | |
| n ← |Text| | |
| for every integer i between 0 and n − L | |
| Window ← Text(i, L) | |
| freqMap ← FrequencyTable(Window, k) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def indexOfPatternMatch (pattern, genome): | |
| indexes = [] | |
| patternLength = len(pattern) | |
| for (index, _) in enumerate(genome): | |
| if genome[index:(patternLength+index)] == pattern: | |
| indexes.append(index) | |
| return " ".join(str(item) for item in indexes) | |
| def loadGenome(path, pattern): | |
| file = open(path, 'r') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| testInput = 'AAAACCCGGT' | |
| def getReverseComplement (DnaString): | |
| allowedTypesMap = {'A': 'T', 'G': 'C', 'T':'A', 'C': 'G'} | |
| result = [allowedTypesMap[char] for char in (DnaString)] | |
| return ("".join(result))[::-1] | |
| print(getReverseComplement(testInput)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| ALGORITHM: | |
| PatternCount(Text, Pattern) | |
| count ← 0 | |
| for i ← 0 to |Text| − |Pattern| | |
| if Text(i, |Pattern|) = Pattern | |
| count ← count + 1 | |
| return count | |
| **/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useLayoutEffect, useRef, MutableRefObject } from 'react'; | |
| const useFlipAnimation = ( | |
| elemRef: MutableRefObject<HTMLDivElement | null>, | |
| layoutChangeFn: (x: boolean) => void, | |
| whenToRun: boolean | |
| ) => { | |
| const justMounted = useRef(true); | |
| useLayoutEffect(() => { | |
| if (justMounted.current) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const getDiff = (date1, date2) => { | |
| let diff = date1 - date2 | |
| const result = (diff/60) | |
| return result; | |
| } | |
| const parseToSeconds = (time)=> { | |
| const hrsMins = time.split(':') | |
| const secHrs = parseInt(hrsMins[0],10) * 60 * 60 | |
| const secMins = parseInt(hrsMins[1],10) * 60 |
NewerOlder