コード例 #1
0
 def __init__(self):
     """
         position: degrees of antenna's base rotated by motor
         counter_for_overlap: counter to check for overlap
         overlap_thress: maximun degrees that antenna is able to rotate = 360 + overlap
     """
     if Antenna.__instance is not None:
         raise Exception("This class is a singleton!")
     else:
         try:
             self.paths = paths.Paths()
             file_name = "{dir}/{filename}".format(dir="Logs",
                                                   filename='adcs.log')
             with FileReadBackwards(file_name,
                                    encoding="utf-8") as log_file:
                 for line in log_file:
                     position = line.decode().split(',')[0]
                     counter = line.decode().split(',')[1]
                     theta_antenna_pointing = line.split(',')[2]
                     theta = line.split(',')[3]
                     break
         except:
             #@TODO change the default init position and counter
             position = 0
             counter = 0
             theta_antenna_pointing = 0
             theta = 0
         self.position = position
         self.counter_for_overlap = counter
         self.theta = theta
         self.theta_antenna_pointing = theta_antenna_pointing
         self.overlap_thress = 380
         self.sign_for_counter = +1
         self.angle_plot = 0
         Antenna.__instance = self
コード例 #2
0
    def __init__(self, ground_ip):

        self.status_vector = dict()
        self.command_vector = dict()
        self.ground_ip = ground_ip
        self.info_logger = InfoLogger()
        self.data_logger = DataLogger()
        self.adcs_logger = AdcsLogger()
        #@TODO where antenna to start
        #self.adcs_logger.write_info(' {}, {}, {}, {}'.format(0, 0, 0, 0))
        self.elink = elinkmanager.ELinkManager(self, self.ground_ip)
        self.thread_elink = None
        self.data_manager = DataManager(self, self.info_logger,
                                        self.data_logger)
        self.thread_data_manager = None
        self.dmc = dmc.DMC(self)
        self.thread_dmc = None
        self.heat = heat.HEAT(self)
        self.thread_heat = None
        self.adc = adc.ADC(self)
        self.thread_adc = None
        self.tx = tx.TX(self)
        self.thread_tx = None
        self.counterdown = CounterDown(self)
        self.paths = paths.Paths()
        GPIO.setmode(GPIO.BOARD)
        Master.__instance = self
コード例 #3
0
ファイル: TX.py プロジェクト: despargy/Shade
    def __init__(self, master_):

        if TX.__instance is not None:

            raise Exception('This class is a singleton!')
        else:

            self.master = master_
            self.info_logger = self.master.info_logger
            self.counterdown = CounterDown(master_)
            self.sdr_process = None
            self.file_name_temperature = paths.Paths().tx_file
            self.file_name_predefined_data = paths.Paths().tx_file_pre_data
            self.file_img_spon = paths.Paths().tx_img_spon
            self.file_img_fam = paths.Paths().tx_img_fam
            self.TX_code_file = 'sdr_TX.py'
            self.TX_code_sin = 'sin_TX.py'
            self.TX_code_spon = 'img_TX.py'
            self.TX_code_fam = 'fam_TX.py'
            self.pin_led_tx = pins.Pins().pin_led_tx
            GPIO.setmode(GPIO.BOARD)
            GPIO.setup(self.pin_led_tx, GPIO.OUT)
            GPIO.output(self.pin_led_tx, GPIO.LOW)
コード例 #4
0
    def __init__(self):

        self.status_vector = dict()
        self.command_vector = dict()
        self.info_logger = InfoLogger()
        self.data_logger = DataLogger()
        self.data_manager = DataManager(self, self.info_logger,
                                        self.data_logger)
        self.thread_data_manager = None
        self.heat = heat.HEAT_HAI(self)
        self.thread_heat = None
        self.counterdown = CounterDown(self)
        self.paths = paths.Paths()
        self.pin_powerB = pins.Pins(
        ).pin_powerB  # @TODO change it in boot/config.txt
        GPIO.setmode(GPIO.BOARD)
        #GPIO.setup(self.pin_powerB, GPIO.OUT)
        Master.__instance = self
コード例 #5
0
    def __init__(self, ground_ip):

        self.status_vector = dict()
        self.command_vector = dict()
        self.ground_ip = ground_ip
        self.info_logger = InfoLogger()
        self.data_logger = DataLogger()
        self.adcs_logger = AdcsLogger()
        self.elink = elinkmanager.ELinkManager(self,self.ground_ip)
        self.thread_elink = None
        # self.data_manager = DataManager(self, self.info_logger, self.data_logger)
        # self.thread_data_manager = None
        self.tx = tx.TX(self)
        self.thread_tx = None
        self.counterdown = CounterDown(self)
        self.paths = paths.Paths()
        self.pin_powerB = pins.Pins().pin_powerB # @TODO change it in boot/config.txt
        #GPIO.setmode(GPIO.BOARD)
        #GPIO.setup(self.pin_powerB, GPIO.OUT)
        Master.__instance = self
コード例 #6
0
ファイル: initialize_vectors.py プロジェクト: despargy/Shade
import json
import Paths as paths

if __name__ == '__main__':
    path = paths.Paths()
    status_vector = {
        "TEMP_A": 1,
        "TEMP_B": 1,
        "HEAT_B_ON": 0,
        "HEAT_A_ON": 0,
        "IMU": 1,
        "GPS": 1,
        "DEP_READY": 0,
        "KILL": 0,
        "DMC_SLEEP": 0,
        "TX_ON": 0,
        "ADC_MAN": 0,
        "DEP_CONF": 0,
        "COMPASS": 1,
        "DEP_SUCS": 0,
        "RET_AB": 0,
        "RET_READY": 0,
        "RET_CONF": 0,
        "HEAT_SLEEP": 0,
        "RET_SUCS": 0,
        "ALTIMETER": 1,
        "AMP_TEMP": 1,
        "INFRARED": 1
    }
    command_vector = {
        "ADC_MAN": 0,
コード例 #7
0
ファイル: GUI.py プロジェクト: jesusbdelriot/zRobot-GUI
from IK import *
import multiprocessing
from threading import *
from tkinter import *
from Paths import *
from Plot import *
from Velocity import *

D = Derivatives()
FK = ForwardKinematics()
IK = InverseKinematics()
P = Parameters()
Plot = Plot()
T = Paths()
V = Velocity()

q = np.zeros(P.links().shape[0])
signal = np.zeros(P.links().shape[0])
p = np.zeros(3)
o = np.zeros(1)
a = np.zeros(1)
v = np.zeros(3)
w = np.zeros(P.links().shape[0])
time = 0
dt = 0
counter = 0


class trunk:
    @staticmethod
    def algorithm(u, z):
コード例 #8
0
#  This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License 3 as published by
#   the Free Software Foundation.
#
#  This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software Foundation,
#   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.

from CCParser import CCParser
from Paths import *
paths = Paths()


class Configuration(object):
    """
        This is the real class used to manage the configuration of the program
    """
    def __init__(self):
        self._ccp = CCParser(paths.configuration, '7zrecover_configuration')
        self._password_length_end = 3

        self.set_password_length_start(
            self._ccp.get_int_defval('StartPassLenght', 2))
        self.set_password_length_end(
            self._ccp.get_int_defval('PasswordLenght', 3))
        self.set_number_of_process(
コード例 #9
0
    while len(branch) < 3:
        if unique_frame_sequence[i][0] not in branch:
            branch.append(unique_frame_sequence[i][0])
            position.append(unique_frame_sequence[i][1])
        i += 1
    branches.append(zip(branch, position))
    unique_frame_sequence.pop(0)

print branches
print

Branches = list()
for b in branches:
    Branches.append(Branch(Node(*b[0]), Node(*b[1]), Node(*b[2])))

p = Paths()
for B in Branches:
    print B
    p.extend(B)

for i in p.branches:
    print i
    print p.branches[i]

all_paths = p.get_all_path_sequences()
all_paths.sort()
print all_paths, len(all_paths)
print
for p in all_paths:
    print p, len(p), sum(p)
コード例 #10
0
#  This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License 3 as published by
#   the Free Software Foundation.
#
#  This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software Foundation,
#   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.

import traceback
from functools import wraps
from Paths import *; PATHS=Paths()


def W_try_or_log(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except Exception as e:
            debug(traceback.format_exc())

    return wrapper


def debug(string):
    with open(PATHS.debug_file, encoding='utf-8', mode='at') as f:
コード例 #11
0
    - I tried to use regex for the "remove tests" option, but it seemed to fail. Sometimes it was returning true when
      the test didn't existed.  More information at the doc: Regex test
"""

import os
import time
import threading
import traceback
import socket

from datetime import datetime

# Local imports
from Paths import *

PATHS = Paths()
from Debug import W_try_or_log

Queue = []

WRITE_LOOP = False  #used to write_errors, it will write the cracking code

TAB = '''    '''

REMOVE_COMBINATIONS = '''
{tab}if remove_combinations.search(test_word{level}):
{tab}   self._count+=len_word_list**({lnb}-{inb})
{tab}   continue\n
'''

# Should the word be removed? remove_tests.remove(word) ?
コード例 #12
0
def main():
    s = RandomFSSequence(no_of_shifts=2, min_length=50, max_length=100)
    s.generate()

    print s.info("without UGA")

    # a Sequence object
    #t = BiologicalSequence( s.sequence )
    #t = BiologicalSequence( "GCTGGTGGGGTAGCAGGTGTTTCTGTTGACTTGATATTATTTCCTCTGGATACCATTAAAACCAGGCTGCAGAGTCCCCAAGGATTTAGTAAGGCTGGTGGTTTTCATGGAATATATGCTGGCGTTCCTTCTGCTGCTATTGGATCCTTTCCTAATG" )
    t = BiologicalSequence(
        "AAATGACGAACACAGAGGAAAGAAGAGAGGCAACTGCTGAGGTCCCCTAGGCCTTTGAGAAAACGGAGTTGTACCTTTGGCAACATAAGTGCATATCTACAAGAAAGGCGATAATGTAGACACCAAGGGAATGGGTACTGTCCAAAAAGAAATGCCTCACAAATGTCACCATGGCAAAACTAAAAGAGTCTACAAAGTTACCTAGCATGCTGTTGGCATCATTGTAAACAAACAAGTTAAGGGCAAGATTCTTGCCAAGAGAATTAATATGCATATTGGGCATATTAAGCACTCTAAGAGCCAAGATGATTTCCTGAAAGTGTGTGAAGGAAAATAACCAGCATAAAGAGGGAAGCTAAAGAGAAACCTGAAGCTGCAGCCTGTTCCACCCAGAGAAGCACACTTTGTAAGAACCAATGAAAAGGAGCCTGAGCTGCTGGAGTCTATTAACTGAATTCATGGT"
    )
    #t = RandomSequence( 100 )
    #t.generate()
    # t.stops.append( "UGA" )

    print
    print t.info()
    for i in xrange(3):
        print t.colour_frame(i, sep="")
    print "         |" * ((s.length) // 10)

    t.get_stop_sequence()

    print "The raw stop sequence (%s)..." % len(t.stop_sequence)
    print t.stop_sequence
    print

    # now to create paths
    p = Paths(t.stop_sequence)

    print "The sanitised stop sequence (%d)..." % len(p.unique_frame_sequence)
    print p.unique_frame_sequence
    print

    print "Create the branches from the stop sequence..."
    p.create_branches()
    print

    print "Create a tree..."
    T = Tree()

    print "View and graft the branches..."
    for B in p.branches:
        #print B
        T.graft(B)

    print T

    print "Build the paths..."

    paths = T.get_paths(simplify=True)
    print paths
    print

    for frame in xrange(3):
        print "Frameshift sequences for frame %d:" % frame
        for j in T.get_frame_paths(frame):
            print len(j), " : ", j
        print
    """
	frameshifted_sequence, fragments = t.frameshift_from_path( all_paths[0] )
	q = BiologicalSequence( s.sequence )
	print s.info()
	for i in xrange( 3 ):
		print q.colour_frame( i, sep="" )
	print "         |"*(( s.length )//10 )
	print
	
	print " ".join( fragments )
	print
	
	print t.path
	print t.colour_frameshifted_sequence( sep="" )
	print "         |"*(( s.length )//10 )
	"""

    for i in xrange(3):
        all_paths = T.get_frame_paths(i)
        for a in all_paths:
            frameshifted_sequence, fragments, frameshift_signals = t.frameshift_from_path(
                a)
            print t.path
            print t.colour_frameshifted_sequence(sep="")
            print " ".join(fragments)
            print " ".join(frameshift_signals)
            print