Beispiel #1
0
    def __init__(self):
        self.state = 0

        # We have a plant:
        self.plant = Plant(strain="Tomato", ph=7)

        # Mixer to mix the components
        self.mixer = Mixer(step_pin=8, direction_pin=9, enable_pin=10)
        # PH measurements:
        self.ph = PHMeter(pin=1)
        # The main tank pumps:
        self.main_container_pump_in = Pump("Main container pump (in)", pin=4)
        self.main_container_pump_out = Pump("Main container pump (out)", pin=5)
        self.water_level = WaterLevel(pin=0)
        # The tanks with the components:
        self.main_tank = Tank(max_level=0.9,
                              water_level_sensor=self.water_level,
                              pump_in=self.main_container_pump_in,
                              pump_out=self.main_container_pump_out,
                              ph=self.ph,
                              mixer=self.mixer)
        # 4 Pumps for each of the containers:
        self.water_pump = Pump("Water pump", pin=0)
        self.acid_pump = Pump("Acid pump", pin=1)
        self.alkali_pump = Pump("Alkali pump", pin=2)
        self.fertilizer_pump = Pump("Fertilizer pump", pin=3)
        return
Beispiel #2
0
    def add_pista(cls, req, file):
        adapter = DbAdapter()
        #id_usuario = get_id_propio()
        proyecto = req.form['id_proyecto']
        nombre = req.form['nombre_pista']

        pan = req.form['panning']
        instante = req.form['instante']
        #preprocesar pista
        mix = Mixer()
        pistaP = mix.pre_procesar_pista(file, 0)
        adapter.set_pistas_proyecto(nombre, proyecto, file, instante, 0, pan)
Beispiel #3
0
 def mezclar(cls, id_proyecto, listaP, listaSet, panning, instante):
     mx = Mixer()
     lista = []
     for pista in listaP:
         if pista[3].split(" ")[0] in listaSet:
             idP = pista[3].split(" ")[0]
             audioP = pista[0].split(" ")[0]
             durP = 0
             instP = pista[1]
             lista.append([idP, audioP, 50, instP])
     file = open("texto.txt", "w")
     file.write(str(lista))
     audio = mx.mezclar(lista, panning, instante)
     return audio
Beispiel #4
0
 def new_images(self):
     logging.info('open new images dialog has been opened')
     dialog = QtWidgets.QFileDialog()
     dialog.setFileMode(QtWidgets.QFileDialog.AnyFile)
     directory = dialog.getOpenFileNames(None, 'select images', __file__,
                                         "image files(*.png *.jpg *.jpeg)")
     fileNames = directory[0]
     # check that the user choosed 2 images
     if len(fileNames) != 2:
         self.warnDialog("please choose 2 images")
         logging.error("the user has not choosed 2 images")
         return
     image_1 = fileNames[0]
     image_2 = fileNames[1]
     logging.info('images has been loaded')
     # check the size of the tw2 images
     # try :
     mixer = Mixer(image_1, image_2)
     logging.info('mixer Object has been started')
     if not mixer.is_the_same_size():
         self.warnDialog("please check that your images have tha same size")
         logging.critical('user inserted 2 images not having the same size')
         return
     # start mixing and displaying the images components
     self.paths[0] = image_1
     self.paths[1] = image_2
     logging.info('images has the same size and has been prepared to show')
     image_arr1 = mpimg.imread(self.paths[0])
     image_arr2 = mpimg.imread(self.paths[1])
     self.img_arrays = [image_arr1, image_arr2]
     logging.info('making initial mix')
     self.mix()
     logging.info('initial mix Done ...')
     self.Image1ViewerA.setPixmap(
         QtGui.QPixmap(image_1).scaled(self.Image1ViewerA.width(),
                                       self.Image1ViewerA.height(),
                                       QtCore.Qt.IgnoreAspectRatio))
     self.Image2ViewerA.setPixmap(
         QtGui.QPixmap(image_2).scaled(self.Image2ViewerA.width(),
                                       self.Image2ViewerA.height(),
                                       QtCore.Qt.IgnoreAspectRatio))
     #update components
     self.Update_img_componentV2(0, "img1")
     self.Update_img_componentV2(0, "img2")
     # show widgets
     self.centralwidget.show()
     #resize labels
     self.resizeWindow()
     MainWindow.setGeometry(80, 80, 100, 200)
Beispiel #5
0
    def __init__(self, num_mixers: int, channels: int, img_width: int, img_height: int, patch_width: int, patch_height: int, lin_init_fn: object = None):
        super(MLPMixer, self).__init__()

        if (int(num_mixers) < 0):
            raise TypeError(
                "MLP-Mixer architecture cannot contain a negative number of mixers.")

        self.num_mixers = int(num_mixers)

        if (num_mixers == 0):
            raise TypeError("")

        # Does its own validation
        self.to_patches = ImgToPatches(channels,
                                       img_width,
                                       img_height,
                                       patch_width,
                                       patch_height)

        flat_patch_dim = patch_width*patch_height
        self.ppfc = torch.nn.Linear(flat_patch_dim, flat_patch_dim)

        self.mixers = torch.nn.ModuleList(
            [Mixer(self.to_patches._num_patch_channels,
                   patch_width,
                   patch_height,
                   lin_init_fn=lin_init_fn)
             for _ in range(self.num_mixers)])

        self.phln = torch.nn.LayerNorm(
            self.to_patches._num_patch_channels, elementwise_affine=False)
Beispiel #6
0
    def mix(self):
        # prgress bar setup
        self.progressBar.setValue(0)
        self.progressBar.show()
        imgage_1 = None
        imgage_2 = None
        # get images
        if self.Component1ComboBox1.currentText() == "Image 1":
            imgage_1 = self.paths[0]
        if self.Component1ComboBox1.currentText() == "Image 2":
            imgage_1 = self.paths[1]
        if self.Component2ComboBox1.currentText() == "Image 1":
            imgage_2 = self.paths[0]
        if self.Component2ComboBox1.currentText() == "Image 2":
            imgage_2 = self.paths[1]
        #get components
        component_1 = self.Component1ComboBox2.currentText()
        component_2 = self.Component2ComboBox2.currentText()
        # get mixing ration
        mixingRatio_1 = int(self.Component1Slider.value())
        mixingRatio_2 = int(self.Component2Slider.value())
        # get output viewer
        if self.OutputCombobox.currentText() == "Output 1":
            viewer = self.viewer1
        else:
            viewer = self.viewer2
        mixer = Mixer(imgage_1, imgage_2)
        mixer.start()
        mixer.signal.connect(self.updateProgressBar)
        data_after_Mixing = mixer.mix_with_the_opposite(
            component_1, mixingRatio_1, component_2, mixingRatio_2)
        plt.imshow(data_after_Mixing)
        plt.axis('off')
        pth = '../GUI/DSP2022/Task3/images/Output' + str(
            self.OutputCombobox.currentIndex() + 1) + '.png'
        plt.savefig(os.path.realpath(pth), bbox_inches='tight')
        output_image = QtGui.QPixmap(os.path.realpath(pth))
        viewer.setPixmap(
            output_image.scaled(viewer.width(), viewer.height(),
                                QtCore.Qt.IgnoreAspectRatio))

        # hide progress bar
        self.progressBar.hide()
Beispiel #7
0
class Controller:
  """Handles input from the RPC server"""

  def __init__(self):
    self.log = logging.getLogger("Cortex.Controller")
    self.managers = []
    self.mutex = threading.Lock()
    self.mixer = Mixer()
    self.nextID = 1

  def kill(self):
    """Shut down the entire system"""
    # Note we cannot kill the RPC Server from here
    self.mutex.acquire()
    for manager in self.managers:
      manager.kill()
    self.mutex.release()

  def addManager(self, manager, args):
    """Start up a new manager with given args

    manager: String name of manager type
    args: Dict of manager arguments"""
    manager_class = ManagerFactory.getManager(manager)
    if manager_class:
      try:
        self.nextID += 1
        if "depots" in args:
          self.mixer.addLinks(self.nextID, args['depots'])
        self.managers.append(manager_class(self.nextID, self.mixer, args))
        self.managers[-1].start()
      except KeyError, e:
        self.log.error("Manager %s init failed due to missing arg: %s" %
            (self.managers[-1], e))
        return 2
      except Exception, e:
        # Manager init failed due to other reason
        self.log.error("Manager %s init failed: %s\nStack Trace:\n%s" %
            (manager_class.__name__ + str(args), e, traceback.format_exc()))
        return 3
 def _get_mixers(self):
     """
     Get all alsa mixers available and give them a name.
     :return: dict, {mixer1.name: mixer1, ... }
     """
     mixers = {}
     ind = alsaaudio.card_indexes()
     for i in range(0, len(ind)):
         mix = alsaaudio.Mixer(control=alsaaudio.mixers(i)[0],
                               id=0,
                               cardindex=ind[i])
         mixer = Mixer(mix, self._config)
         mixers.update({mixer.name: mixer})
     return mixers
Beispiel #9
0
#    IVs =[]
#    for select in ['iv','hot','cold','univ'] :
#        # not all univ, unpumped IV curves are available
#        index= indexGroups[np.where(np.logical_and(indexGroups[:,0]==temp, indexGroups[:,1]==select))[0],2][0]
#        if not index.size==0:
#            #Initialise the IV responses
#            IVs.append(IV_Response(filenames[index],**kwargs_IV_Response_rawData))
#    #Initialise the Mixer
#    if len(IVs)==3:
#        Mixers.append(Mixer(Pumped=IVs[0],IFHot=IVs[1], IFCold=IVs[2],**kwargs_Mixer_rawData))
#    else:                    
#        Mixers.append(Mixer(Unpumped=IVs[3],Pumped=IVs[0],IFHot=IVs[1], IFCold=IVs[2],**kwargs_Mixer_rawData))
  
#With kwargs
Mixers = []
for temp in np.unique(indexGroups[:,0]):
    IVs =[]
    for select in ['iv','hot','cold','univ'] :
        # not all univ, unpumped IV curves are available
        index= indexGroups[np.where(np.logical_and(indexGroups[:,0]==temp, indexGroups[:,1]==select))[0],2][0]
        if not index.size==0:
            #Initialise the IV responses
            IVs.append(filenames[index])
    #Initialise the Mixer
    if len(IVs)==3:
        Mixers.append(Mixer(Pumped=IVs[0],IFHot=IVs[1], IFCold=IVs[2],**kwargs_Mixer_rawData))
    else:                    
        Mixers.append(Mixer(Unpumped=IVs[3],Pumped=IVs[0],IFHot=IVs[1], IFCold=IVs[2],**kwargs_Mixer_rawData))
    

Beispiel #10
0
class Fertigator:
    def __init__(self):
        self.state = 0

        # We have a plant:
        self.plant = Plant(strain="Tomato", ph=7)

        # Mixer to mix the components
        self.mixer = Mixer(step_pin=8, direction_pin=9, enable_pin=10)
        # PH measurements:
        self.ph = PHMeter(pin=1)
        # The main tank pumps:
        self.main_container_pump_in = Pump("Main container pump (in)", pin=4)
        self.main_container_pump_out = Pump("Main container pump (out)", pin=5)
        self.water_level = WaterLevel(pin=0)
        # The tanks with the components:
        self.main_tank = Tank(max_level=0.9,
                              water_level_sensor=self.water_level,
                              pump_in=self.main_container_pump_in,
                              pump_out=self.main_container_pump_out,
                              ph=self.ph,
                              mixer=self.mixer)
        # 4 Pumps for each of the containers:
        self.water_pump = Pump("Water pump", pin=0)
        self.acid_pump = Pump("Acid pump", pin=1)
        self.alkali_pump = Pump("Alkali pump", pin=2)
        self.fertilizer_pump = Pump("Fertilizer pump", pin=3)
        return

    # Getters for the sensors:
    def get_mixer(self):
        return self.mixer

    def get_water_level(self):
        return self.water_level

    def get_ph(self):
        return self.ph

    def get_main_tank(self):
        return self.main_tank

    def get_plant(self):
        return self.plant

    def get_state(self):
        return self.state

    def set_state(self, state):
        # Load the last state
        if self.state:
            print("Loading machine state...")
            self.load_machine_state()
            print("Done! Launching automatic mode...")
            Thread(target=self.automatic_mode, args=()).start()
        else:
            print("Saving machine state...")
            self.save_machine_state()
            self.stop_pumps()
            print("Done! Good bye!")
        return

    def automatic_mode(self):
        water_amount = 0.35
        fertilize_amount = 0.35
        alkali_amount = 0.1
        acid_amount = 0.1
        if water_amount + fertilize_amount + alkali_amount + acid_amount > self.main_tank.max_level:
            print(
                "Water: {} + Fertilize: {} + Alkali: {} + Acid: {} > Maximum tank level: {} "
                .format(water_amount, fertilize_amount, alkali_amount,
                        acid_amount, self.main_tank.max_level))
            return
        # First goes water:
        self.water_pump.set_state(1)
        while self.water_level.get_state() < 0.6:
            time.sleep(1)
        self.water_pump.set_state(0)
        print("Water added!")
        # The second is fertilizer:
        self.fertilizer_pump.set_state(1)
        while self.water_level.get_state() < 0.8:
            time.sleep(1)
        self.fertilizer_pump.set_state(0)
        print("Fertilizer added!")

        # Now we need to mix it.
        self.mixer.set_state(1)

        # Control PH while automatic mode is enabled.
        while self.state:
            # Let us check PH
            ph = self.ph.get_state()
            time.sleep(15)
            if ph >= self.plant.ph + self.plant.ph_variance:
                # Too high PH level, need to add the acid:
                self.acid_pump.set_state(1)
                time.sleep(5)
                self.acid_pump.set_state(0)
                self.ph.state -= 0.5

            # Too low PH level, need to add the alkali:
            if ph <= self.plant.ph - self.plant.ph_variance:
                self.alkali_pump.set_state(1)
                time.sleep(5)
                self.alkali_pump.set_state(0)
                self.ph.state += 0.5
                continue
        time.sleep(5)
        self.mixer.set_state(0)
        #self.main_container_pump_in.set_state(1)
        #self.main_container_pump_out.set_state(1)
        #time.sleep(5)
        #self.main_container_pump_in.set_state(0)
        #self.main_container_pump_out.set_state(0)
        return

    def save_machine_state(self):
        json_data = open("config.json", "w")
        data = json.dumps({
            "strain": self.plant.strain,
            "plant_ph": self.plant.ph
        })
        self.plant.strain = data['plant_strain']
        self.plant.ph = data['plant_ph']
        return

    def load_machine_state(self):
        json_data = open("config.json", "r")
        data = json.loads(json_data)
        self.plant.strain = data['plant_strain']
        self.plant.ph = data['plant_ph']
        return

    def stop_pumps(self):
        self.main_container_pump_in.set_state(0)
        self.main_container_pump_out.set_state(0)
        self.water_pump.set_state(0)
        self.acid_pump.set_state(0)
        self.alkali_pump.set_state(0)
        self.fertilizer_pump.set_state(0)
Beispiel #11
0
 def create_mixer_panel(self,input1,input2,output):
     mixer = Mixer(self,input1.image,input2.image,output.image1,output.image2)
     return mixer
Beispiel #12
0
def calculate_eff(q_cap, work_fl, amb_work_fl_cond, amb_work_fl_evap, t_cond,
                  overc_cond, t_evap, overh_evap, press_bef_turb,
                  temp_bef_turb, pr_evap, amb_pr_evap, pr_cond, amb_pr_cond,
                  pr_boil, amb_t_evap_in, amb_t_evap_out, amb_t_cond_in,
                  amb_t_cond_out, amb_p_evap_out, amb_p_cond_out,
                  isent_eff_turb, isent_eff_pump, elec_eff_pump,
                  isent_eff_comp, eff_boil, fuel_heat_val, eff_turboeq):

    # The functions starts with creating tables to collect values of important attributes, each of them has 11 places:
    # indexes 1,2,3,4 for refrigeration cycle (1 is before the compressor, 4 is before evaporator),
    # indexes 5,6,7,8 - for power cycle (5 is before the turbine, 8 is before the boiler)
    # indexes 9, 10 - for condenser applied for both cycles
    pres = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    temp = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    enth = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    entr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

    temp[10] = t_cond - overc_cond
    temp[3] = temp[10]
    temp[7] = temp[10]
    temp[4] = t_evap
    pres[5] = press_bef_turb
    temp[5] = temp_bef_turb
    pres[8] = press_bef_turb / pr_boil

    # Calculation of the refrigeration cycle starts from throttling valve, as for the next step the value of enthalpy
    # in two-phase zone is needed.
    throttling_valve = ThrottlingValve(temp_in=temp[3],
                                       overc_cond=overc_cond,
                                       temp_out=temp[4],
                                       work_fl=work_fl)
    throttling_valve.calculate()
    enth[3] = throttling_valve.enth_in
    entr[3] = throttling_valve.entr_in
    enth[4] = throttling_valve.enth_out
    entr[4] = throttling_valve.entr_out
    pres[3] = throttling_valve.press_in
    pres[4] = throttling_valve.press_out
    enth[10] = throttling_valve.enth_in
    entr[10] = throttling_valve.entr_in
    pres[10] = pres[3]
    pres[7] = pres[3]
    pres[9] = pres[10] / pr_cond
    pres[2] = pres[9]
    pres[6] = pres[9]

    # The next step is evaporator:
    evaporator = Evaporator(enth_in=enth[4],
                            temp_in=temp[4],
                            overh=overh_evap,
                            q_cap=q_cap,
                            work_fl=work_fl,
                            amb_work_fl=amb_work_fl_evap,
                            pr=pr_evap,
                            amb_pr=amb_pr_evap,
                            amb_temp_in=amb_t_evap_in,
                            amb_temp_out=amb_t_evap_out,
                            amb_press_out=amb_p_evap_out)
    evaporator.set_attr_refr_cyc()
    evaporator.calculate()
    temp[1] = evaporator.temp_out
    pres[1] = evaporator.press_out
    enth[1] = evaporator.enth_out
    entr[1] = evaporator.entr_out
    throttling_valve.mass_fl = evaporator.mass_fl

    # The next step, after calculating output of evaporator, is a compressor.
    compressor = Compressor(press_in=pres[1],
                            entr_in=entr[1],
                            enth_in=enth[1],
                            work_fl=work_fl,
                            press_out=pres[2],
                            isent_eff=isent_eff_comp,
                            mass_fl=evaporator.mass_fl)
    compressor.calculate()
    temp[2] = compressor.temp_out
    enth[2] = compressor.enth_out
    entr[2] = compressor.entr_out

    # With the compressor power demand calculated, it is possible to calculate the power demand of the turbine using
    # the class Turboequipment, which was created for the purpose of the combined cycle.

    # Turbine:
    turbine = Turbine(cycle_name="cycle",
                      press_in=pres[5],
                      temp_in=temp[5],
                      press_out=pres[6],
                      work_fl=work_fl,
                      isent_eff=isent_eff_turb)
    turbine.calculate()
    entr[5] = turbine.entr_in
    enth[5] = turbine.enth_in
    entr[6] = turbine.entr_out
    enth[6] = turbine.enth_out
    temp[6] = turbine.temp_out

    turboequipment = Turboequipment(compressor=compressor,
                                    turbine=turbine,
                                    eff=eff_turboeq)
    turboequipment.calculate()

    # Pump:
    pump = Pump(cycle_name="cycle",
                mass_fl=turbine.mass_fl,
                press_in=pres[7],
                press_out=pres[8],
                temp_in=temp[7],
                work_fl=work_fl,
                isent_eff=isent_eff_pump,
                elec_eff=elec_eff_pump)
    # For the instance of class Pump received mass flow as argument, the function calculate() will calculate powers.
    # Using additionally function Pump.calculate_powers() is unnecessary.
    pump.calculate()
    enth[7] = pump.enth_in
    entr[7] = pump.entr_in
    entr[8] = pump.entr_out
    enth[8] = pump.enth_out
    temp[8] = pump.temp_out

    # The last step is creating an instance of class Boiler in order to calculate the value of fuel demand.
    boiler = Boiler(temp_in=temp[8],
                    temp_out=temp[5],
                    press_out=pres[5],
                    work_fl=work_fl,
                    mass_fl=turbine.mass_fl,
                    fuel_heat_val=fuel_heat_val,
                    eff=eff_boil,
                    pr=pr_boil)
    boiler.calculate_fuel_dem()

    # In order to calculate required mass flow of the ambient air in condenser:
    mixer = Mixer(press_in=pres[6],
                  enth_in_1=enth[6],
                  enth_in_2=enth[2],
                  mass_fl_in_1=turbine.mass_fl,
                  mass_fl_in_2=compressor.mass_fl,
                  work_fl=work_fl)
    mixer.calculate()
    temp[9] = mixer.temp_out
    pres[9] = mixer.press_out
    enth[9] = mixer.enth_out
    entr[9] = mixer.entr_out
    # To be sure, that the TESPy software will read the points properly (it's unsure what phase the fluid will be),
    # the refrigeration condenser will be calculated, as it uses values of enthalpies in the function calculate(),
    # which, in combination with pressures, ensures proper choice of the parameters points on the p-h plot.

    condenser = Condenser(enth_out=enth[10],
                          enth_in=enth[9],
                          press_in=pres[9],
                          mass_fl=mixer.mass_fl_out,
                          work_fl=work_fl,
                          amb_work_fl=amb_work_fl_cond,
                          pr=pr_cond,
                          amb_pr=amb_pr_cond,
                          amb_temp_in=amb_t_cond_in,
                          amb_temp_out=amb_t_cond_out,
                          amb_press_out=amb_p_cond_out)
    condenser.set_attr_combined_cycle()
    condenser.calculate_combined_cyc()
    temp_in_cond = evaporator.generate_enthalpies_data(accuracy=10)

    efficiency = round(
        evaporator.q_cap / (boiler.fuel_dem * boiler.fuel_heat_val), 8)
    print(efficiency)
    return efficiency
Beispiel #13
0
                       **kwargs_IV_Response_rawData)

kwargs_IV_Response_rawData['fixedOffset'] = [-1.362, -4.5]
Pumped = IV_Response('DummyData/DoubleJunction/Pumped.csv',
                     **kwargs_IV_Response_rawData)

print('Double check if the offset is corrected properly.')
plot(Unpumped.binedIVData)
plot(Pumped.binedIVData)
plot(Unpumped.offsetCorrectedSortedIVData)
plot(Pumped.offsetCorrectedSortedIVData)

print('Initialise Mixer.')
kwargs_Mixer_rawData['skip_admittance_recovery'] = True
kwargs_Mixer_rawData['fLO'] = 831.6e9
M = Mixer(Unpumped, Pumped, **kwargs_Mixer_rawData)

print('Select the voltage range for the photon step.')
vrange = Pumped.binedIVData[
    0,
    np.logical_and(Pumped.binedIVData[0] > 2, Pumped.binedIVData[0] < 2.5)]

########

from IV_Class import IV_Response, kwargs_IV_Response_rawData
from Mixer import Mixer, kwargs_Mixer_rawData
from plotxy import plot, plotcomplex
import matplotlib.pylab as plt
import numpy as np

kwargs_IV_Response_rawData['skip_IV_simulation'] = True  #this is due to a bug
Beispiel #14
0
    print("<<< INITIALIZATION SEQUENCE started >>>")

# Load the configuration file
if Configuration.DEBUG:
    print("- Loading configuration file... ", end="")

settings = Configuration.Configuration()

if Configuration.DEBUG:
    print("OK --> {0}".format(settings.items))

# Instantiate the mixer object
if Configuration.DEBUG:
    print("Warming up the mixer engine... ", end="")

mixer = Mixer(settings.get_all_range_min(), settings.get_all_range_max(), Configuration.CHANNEL_REV,
              Configuration.DEBUG)

if Configuration.DEBUG:
    print("OK")

# Instantiate motor objects
if Configuration.DEBUG:
    print("- Checking motors... ", end="")

for i in range(0, 4):
    motors.append(Motor(i, Configuration.ESC_RATE_MIN, Configuration.ESC_RATE_MAX, Configuration.DEBUG))

if Configuration.DEBUG:
    print("OK")

# Instantiate the receiver object
Beispiel #15
0
from Familiar import Familiar
from Graphics import Graphics
from Homura import Homura
from Kyoko import Kyoko
from Mami import Mami
from Map import Map
from Mixer import Mixer
from Player import makePlayer
from Sayaka import Sayaka
from State import State
from TurnManager import TurnManager
from Walpurgisnacht import Walpurgisnacht
from Witch import Witch

board = Map.getInstance()
mixer = Mixer.getInstance()
turnManager = TurnManager.getInstance()


class PlayState(State):
    def addFamiliar(self):
        familiar = makeEnemy(Familiar)
        board.addCharacter(familiar)
        self.familiars.append(familiar)

    def addWitch(self):
        witch = makeEnemy(Witch)
        board.addCharacter(witch)
        self.witches.append(witch)

        for i in range(0, 2):
Beispiel #16
0
 def __init__(self):
   self.log = logging.getLogger("Cortex.Controller")
   self.managers = []
   self.mutex = threading.Lock()
   self.mixer = Mixer()
   self.nextID = 1
Beispiel #17
0
    kwargs_Mixer_John['maskingWidth'] = [.2, 1.75]
elif args.case == 'IVOffset':
    kwargs_Mixer_John['maskingWidth'] = None
elif args.case == 'IVOffsetFixedMask':
    kwargs_Mixer_John['maskingWidth'] = [.2, .75]

directory = 'Mixer_Unit_Test/' + args.folder + '/'
if not os.path.exists(directory):
    os.makedirs(directory)

log.info('MIXER_Unit_Test: Initialise Mixer object.')
if args.case == 'IVOffset' or args.case == 'IVOffsetFixedMask':
    kwargs_IV_Response_John['fixedOffset'] = [0.101802, 9.8]
    Unpumped = IV_Response('DummyData/John/Unpumped.csv',
                           **kwargs_IV_Response_John)
    M = Mixer(Unpumped, 'DummyData/John/Pumped.csv', **kwargs_Mixer_John)
else:
    M = Mixer('DummyData/John/Unpumped.csv', 'DummyData/John/Pumped.csv',
              **kwargs_Mixer_John)

titleskip = None  # if the title is required replace all titleskip with titleskip

log.info('MIXER_Unit_Test: Process figures.')
title = newfig('Unpumped_Pumped')
plot(M.Unpumped.binedIVData, label='Unpumped')
plot(M.Pumped.binedIVData, label='Pumped')
pltsettings(directory + title,
            xlabel=lbl['mV'],
            ylabel=lbl['uA'],
            xlim=[0, 5],
            ylim=[0, 350],
Beispiel #18
0
from Familiar import Familiar
from Graphics import Graphics
from Homura import Homura
from Kyoko import Kyoko
from Mami import Mami
from Map import Map
from Mixer import Mixer
from Player import makePlayer
from Sayaka import Sayaka
from State import State
from TurnManager import TurnManager
from Walpurgisnacht import Walpurgisnacht
from Witch import Witch

board = Map.getInstance()
mixer = Mixer.getInstance()
turnManager = TurnManager.getInstance()

class PlayState(State):
    def addFamiliar(self):
        familiar = makeEnemy(Familiar)
        board.addCharacter(familiar)
        self.familiars.append(familiar)

    def addWitch(self):
        witch = makeEnemy(Witch)
        board.addCharacter(witch)
        self.witches.append(witch)

        for i in range(0, 2):
            self.addFamiliar()