Ejemplo n.º 1
0
    def __init__(self, node, test_directory):
        """The Merge class constructor.

        Arguments:
        node - The XML node to be read.
        test_directory - The test directory.
        """

        Test.__init__(self, node, test_directory)

        self.command = []
        self.unique_params = {'time_unit': ['', '']}

        for element in node.iter(tag='unique'):
            self.unique = Flat(element, self.unique_params)
            for item in element.iter(tag='sources'):
                self.sources = Sources(item, test_directory)

        self.create_command(test_directory)
Ejemplo n.º 2
0
    def __init__(self, node, test_directory):
        """The Source class constructor.

        Arguments:
        node - The XML node to be read.
        test_directory - The test directory.
        """
        self.parameters = {
            'format': ['', 'Missing source format.'],
            'time_stamp': ['', 'Missing source time stamp.'],
            'time_unit': ['', 'Missing source time unit.'],
            'prefix': ['', ''],
            'line_counter': ['', ''],
            'input_file': ['', 'Missing source input file.']
        }

        self.data = Flat(node, self.parameters)
        self.source = []
        self.create_source(test_directory)
Ejemplo n.º 3
0
class Maker(Test):
    """A vcdMaker specific test class."""
    def __init__(self, node, test_directory):
        """The Maker class constructor.

        Arguments:
        node - The XML node to be read.
        test_directory - The test directory.
        """

        Test.__init__(self, node, test_directory)

        self.command = []
        self.unique_params = {
            'input_file': ['', 'Missing input file'],
            'time_unit': ['', 'Missing time unit'],
            'line_counter': ['', '']
        }

        for element in node.iter(tag='unique'):
            self.unique = Flat(element, self.unique_params)

        self.create_command(test_directory)

    def create_command(self, test_directory):
        """Builds the vcdMaker specific command line."""

        self.command.append('-t')
        self.command.append(self.unique.get_parameter('time_unit'))

        if self.unique.get_parameter('line_counter'):
            self.command.append('-c')
            self.command.append(self.unique.get_parameter('line_counter'))

        self.command.append('-o')
        self.command.append(
            os.path.join(test_directory,
                         self.common.get_parameter('output_file')))
        self.command.append(
            os.path.join(test_directory,
                         self.unique.get_parameter('input_file')))
Ejemplo n.º 4
0
def flat_add():
    if request.method == "GET":
        return render_template("flats/add.html")
    next_id = next(next_index)
    new_flat = Flat(id=next_id,
                    name=request.form.get("flat_name"),
                    address=request.form.get("flat_address"),
                    electricity_t1=request.form.get("electricity_t1"),
                    hot_water=request.form.get("hot_water"),
                    cold_water=request.form.get("cold_water"))
    FLATS[next_id] = new_flat
    return redirect(url_for("flat_app.list"))
Ejemplo n.º 5
0
    def __init__(self, node, test_directory):
        """The Maker class constructor.

        Arguments:
        node - The XML node to be read.
        test_directory - The test directory.
        """

        Test.__init__(self, node, test_directory)

        self.command = []
        self.unique_params = {
            'input_file': ['', 'Missing input file'],
            'time_unit': ['', 'Missing time unit'],
            'line_counter': ['', '']
        }

        for element in node.iter(tag='unique'):
            self.unique = Flat(element, self.unique_params)

        self.create_command(test_directory)
Ejemplo n.º 6
0
    def new_objekt(self):
        try:
            if not self.obj_list:
                self.objnr = 1
            else:
                #get the last element with -1 and add +1 to its objnr to always increase the number
                self.objnr = self.obj_list[-1].objnr + 1 

            vname = input("What's the responsible agent's name? ")
            nname = input("And what's his surname?")

            self.agent_name = vname + nname


            temp = input("Is the property to sell (1) or rent (2)?")

            if temp == 1:
                self.tbr = True
            elif temp == 2:
                self.tbr = False
            else:
                self.tbr = False #for now

            #get the property's price
            self.price = input("What's the property's price?")

            #get the property's area size
            self.area_size = input("What's the property's size in m^2?")

            temp = input("Is your property a house (1), a flat (2), or an estate (3)?")

            if temp == 1: #property is a house
                temp = input("Is your property a multi family house? (y/n)").lower()
                if temp == "y":
                    self.multifam = True
                elif temp == "n":
                    self.multifam = False
            elif temp == 2: #property is a flat
                self.count_rooms = input("How many rooms does your house have?")
                temp = input("Does your house have a bathtub (1) or a shower cabin? (2)")
                if temp == 1:
                    self.bathtub_showerc = True
                elif temp == 2:
                    self.bathtub_showerc = False

                self.obj_list.app(Flat(self.objnr, self.agent_name, self.tbr, self.price, self.area_size, self.count_rooms, self.bathtub_showerc))
            elif temp == 3: #property is an estate
                #to do

        except Exception:
            print "Error!"
Ejemplo n.º 7
0
class Merge(Test):
    """A vcdMerge specific test class."""
    def __init__(self, node, test_directory):
        """The Merge class constructor.

        Arguments:
        node - The XML node to be read.
        test_directory - The test directory.
        """

        Test.__init__(self, node, test_directory)

        self.command = []
        self.unique_params = {'time_unit': ['', '']}

        for element in node.iter(tag='unique'):
            self.unique = Flat(element, self.unique_params)
            for item in element.iter(tag='sources'):
                self.sources = Sources(item, test_directory)

        self.create_command(test_directory)

    def create_command(self, test_directory):
        """Builds the vcdMerge specific command line."""

        self.command.append('-o')
        self.command.append(
            os.path.join(test_directory,
                         self.common.get_parameter('output_file')))

        if self.unique.get_parameter('time_unit'):
            self.command.append('-t')
            self.command.append(self.unique.get_parameter('time_unit'))

        for source in self.sources.get():
            self.command.append(source.get())
Ejemplo n.º 8
0
class Source(object):
    """A class for storing a source specific parameters."""
    def __init__(self, node, test_directory):
        """The Source class constructor.

        Arguments:
        node - The XML node to be read.
        test_directory - The test directory.
        """
        self.parameters = {
            'format': ['', 'Missing source format.'],
            'time_stamp': ['', 'Missing source time stamp.'],
            'time_unit': ['', 'Missing source time unit.'],
            'prefix': ['', ''],
            'line_counter': ['', ''],
            'input_file': ['', 'Missing source input file.']
        }

        self.data = Flat(node, self.parameters)
        self.source = []
        self.create_source(test_directory)

    def create_source(self, test_directory):
        """Builds the list of source parameters."""
        self.source = [
            self.data.get_parameter('format'),
            self.data.get_parameter('time_stamp'),
            self.data.get_parameter('time_unit'),
            self.data.get_parameter('prefix'),
            self.data.get_parameter('line_counter'),
            os.path.join(test_directory, self.data.get_parameter('input_file'))
        ]

    def get(self):
        """Returns the source string to be passed as an argument
        to vcdMerge.
        """

        return ','.join(self.source)
Ejemplo n.º 9
0
#!/usr/bin/env python3
from flat import Flat
f = Flat(dumping=True,
         m="bigraphene",
         Exc=1,
         Hc=200,
         Ex=0.3,
         omega=5e10,
         T=300,
         n=100,
         dt=1e-13,
         alltime=1e-8)
f.run(True)
Ejemplo n.º 10
0
from fullred import FullRed
from sine import Sine
from flat import Flat
from wheel import Wheel
from patterns import PATTERNS

COLS = 20
ROWS = 12

# Testing toggle
if False:
    pat = PATTERNS['dear-big']
    effects = [
        Waves(COLS, ROWS, pat),
        Sine(COLS, ROWS, pat),
        Flat(COLS, ROWS, pat),
        Wheel(COLS, ROWS, pat)
    ]
else:
    pat = PATTERNS['orphan-asylum-3']
    effects = [Flat(COLS, ROWS, pat)]
#    effects = [Waves(COLS, ROWS, PATTERNS['dear-bold'])]

#-------------------------------------------------------------------------------
# handle command line

fake = os.environ.get('FAKE')

if len(sys.argv) == 1:
    IP_PORT = '127.0.0.1:7890'
elif len(sys.argv
Ejemplo n.º 11
0
import numpy as np
from flat import Flat

n_e = 3
n_o = 10
Excl = [0, 0.2, 0.5]
omegal = np.linspace(5e11 / n_o, 5e11, n_o)
woH = np.zeros((n_e, n_o))
woHt = np.zeros((n_e, n_o))
for i, Exc in enumerate(Excl):
    for j, omega in enumerate(omegal):
        f = Flat(m="graphene",
                 Exc=Exc,
                 Hc=0,
                 Ex=0.3,
                 omega=omega,
                 T=100,
                 n=100,
                 dt=1e-14,
                 alltime=1e-8)
        d = f.run(True)
        woH[i, j] = d["power"][0]
        woHt[i, j] = d["tau"][0]
wH = np.zeros((n_e, n_o))
'''
for i, Exc in enumerate(Excl):
    for j, omega in enumerate(omegal):
        f = Flat(m="graphene",
                 Exc=Exc,
                 Hc=400,
                 Ex=0.3,
run_time = 0
lowest_fail = 1
failed_route_list = []
while run_time < 100:

    if len(failed_route_list) != 0:
        x = failed_route_list[0]
        temp = routes[int(x) - 1]
        del routes[int(x) - 1]
        random_insert(routes, temp)

    route_number = 1

    # adjust for 18x13 or 18x17 board
    l1 = Flat((18, 17, 7))
    gates = []

    rows = csv.split("\n")
    i = 0
    for row in rows:
        # board1 gates: 3 - 29 // board2 gates: 3 - 54
        if i > 3 and i < 54:
            columns = row.split(",")
            gates.append(np.array(columns))
        i += 1
    for gate in np.array(gates):
        l1.is_gate((int(gate[1]), int(gate[2]), 0), gate[0])

    failed_routes = 0
    failed_route_list1 = []
Ejemplo n.º 13
0
#!/usr/bin/env python3

import sys
import numpy as np
from matplotlib import pyplot as plt
from flat import Flat

Excl = np.linspace(0, 2, 6)
Hcl = np.linspace(20, 5000, 50)
for Exc in Excl:
    line = []
    for Hc in Hcl:
        f = Flat(m="bigraphene_0.01_1",
                 Exc=Exc,
                 Hc=Hc,
                 waves=[[1, 0, 0, 1e12, 0]],
                 T=300,
                 n=100,
                 dt=1e-13,
                 alltime=1e-9)
        line.append(f.run(True)["power"][1][0])
    plt.plot(Hcl, line, label="Exc=%.2f" % Exc)
plt.legend()
plt.gca().set_ylim(bottom=0)
plt.savefig("magnetic.png")
Ejemplo n.º 14
0
from flat import Flat
from l2_utils import create_model

w_0 = 89597.9095428

# area weight
w_1 = 139.21067402

# rooms weight
w_2 = -8738.01911233

coeffs = [w_1, w_2, w_0]
model = create_model(coeffs)

while True:
    area = int(input("area : "))
    rooms = int(input("rooms : "))
    flat = Flat(area, rooms)
    print("predicted price : ", int(model(flat) * 100) / 100)
    print()
Ejemplo n.º 15
0
from waves import Waves
from fullred import FullRed
from sine import Sine
from flat import Flat
from wheel import Wheel
from patterns import PATTERNS

COLS = 20
ROWS = 12

# Testing toggle
if False:
    pat = PATTERNS['dear-big']
    effects = [Waves(COLS, ROWS, pat),
               Sine(COLS, ROWS, pat),
               Flat(COLS, ROWS, pat),
               Wheel(COLS, ROWS, pat)]
else:
    effects = [Waves(COLS, ROWS, PATTERNS['dear-bold'])]


#-------------------------------------------------------------------------------
# handle command line

fake = os.environ.get('FAKE')

if len(sys.argv) == 1:
    IP_PORT = '127.0.0.1:7890'
elif len(sys.argv) == 2 and ':' in sys.argv[1] and not sys.argv[1].startswith('-'):
    IP_PORT = sys.argv[1]
else:
from node import Node
from flat import Flat
import numpy as np
import random
import csv

csv = open('circuit_board_1.csv', "r").read()

l1 = Flat((18, 13, 7))
gates = []

rows = csv.split("\n")
i = 0
for row in rows:
    if i > 3 and i < 29:
        columns = row.split(",")
        gates.append(np.array(columns))
    i += 1
for gate in np.array(gates):
    l1.is_gate((int(gate[1]), int(gate[2]), 0), gate[0])

routes = []
j = 0
for row in rows:
    if j > 31 and j < 62:
        columns = row.split(",")
        routes.append(np.array(columns))
    j += 1

route_number = 1
failed_routes = 0
Ejemplo n.º 17
0
Archivo: cvc.py Proyecto: citrux/flat
#!/usr/bin/env python3

import sys
import numpy as np
from flat import Flat

result = np.zeros((2, 21))
result[0, :] = np.linspace(-2, 2, 21)
for i, Exc in enumerate(result[0, :]):
    f = Flat(m="graphene", Exc=Exc, T=300, n=100, dt=1e-14, alltime=1e-8)
    d = f.run(True)
    result[1, i] = d["v_y"][0]
np.savetxt("cvc.dat", result.transpose())
Ejemplo n.º 18
0
#!/usr/bin/env python3

import numpy as np
from flat import Flat

freqs = np.linspace(5.25e14, 5.35e14, 3)
waves = lambda freq: [[1, 0, 0, 1e12, 0], [10, 0, 0, freq, 0]]
population = []

for freq in freqs:
    f = Flat(m="bigraphene_0.01_2",
             waves=waves(freq),
             T=300,
             n=100,
             dt=1e-15,
             alltime=1e-9)
    d = f.run()
    population.append(d["population"])

population = np.array(population)
data = np.hstack([freqs.reshape(len(freqs), 1), population[:, :, 0]])
np.savetxt("ps.dat", data)
Ejemplo n.º 19
0
from flat import Flat
from restroom import Restroom
from room import Room

# Инфо о квартире (номер квартиры, номер дома, название улицы, город, колличество комнат, метраж, имя владельца,
# этаж, основной материал)
flat = Flat(number_flat=33,
            number_house=12,
            street="Street",
            city="Kyiv",
            footage=60.4,
            owner="Vasya",
            floor=2,
            material="glass",
            rooms=(Room("Kitchen", True,
                        41.0), Room("Sleeping room", True,
                                    13.3), Room("Children room", True, 4.1)))

# Инфо о санузле (метраж, можно проверить смежный или нет по методу view_adjacency() и проверить количество санузлов
# по методу view_count())
restroom = Restroom(1.0)
restroom1 = Restroom(5.0)
restroom2 = Restroom(7.0)


# Сгенерировать номер учетной записи
def number_of_account():
    print(
        str(flat.number_flat) + str(flat.number_house) + str(flat.owner[0]) +
        str(flat.city[2]) + str(flat.floor))
from node import Node
from flat import Flat
import numpy as np
import random
import csv

csv = open('circuit_board_1.csv', "r").read()
l1 = Flat((18, 13, 7))

gates = []

rows = csv.split("\n")
i = 0
for row in rows:
    # board1 gates: 3 - 29 // board2 gates: 3 - 54
    if i > 3 and i < 29:
        columns = row.split(",")
        gates.append(np.array(columns))
    i += 1
for gate in np.array(gates):
    l1.is_gate((int(gate[1]), int(gate[2]), 0), gate[0])

routes = []
j = 0
for row in rows:
    # board 1 : 1{31 - 62} // 2{64 - 105} // 3{107 - 158}
    # board 2 : 1{56 - 107} // 2{109 - 170} // 3{172 - 243}
    if j > 31 and j < 62:
        columns = row.split(",")
        routes.append(np.array(columns))
    j += 1
Ejemplo n.º 21
0
#!/usr/bin/env python3
import numpy as np
from matplotlib import pyplot as plt
from flat import Flat
f = Flat(dumping=True,
         m="graphene",
         Exc=1,
         T=300,
         n=100,
         dt=1e-13,
         alltime=1e-7)
f.run(True)
thetas = np.loadtxt("theta.dat")
plt.hist(thetas, 40)
plt.show()