예제 #1
0
    def __init__(self, data, densnet_unet_config, compression_coefficient,
                 growth_rate, sample_no, validation_samples,
                 no_sample_per_each_itr, train_tag, validation_tag, test_tag,
                 img_name, label_name, torso_tag, log_tag, tumor_percent,
                 other_percent, Logs, fold, server_path):
        settings.init()

        # ==================================
        # densenet_unet parameters:
        self.densnet_unet_config = densnet_unet_config
        self.compression_coefficient = compression_coefficient
        self.growth_rate = growth_rate
        # ==================================
        self.train_tag = train_tag
        self.validation_tag = validation_tag
        self.test_tag = test_tag
        self.img_name = img_name
        self.label_name = label_name
        self.torso_tag = torso_tag
        self.data = data
        # ==================================
        self.learning_decay = .95
        self.learning_rate = 1E-5
        self.beta_rate = 0.05

        self.img_padded_size = 519
        self.seg_size = 505

        self.GTV_patchs_size = 49  # 61#33 #            61
        self.patch_window = 63  ##87#79#57#47          73
        self.sample_no = sample_no
        self.batch_no = 7
        self.batch_no_validation = 30
        self.validation_samples = validation_samples
        self.display_step = 100
        self.display_validation_step = 1
        self.total_epochs = 10
        self.loss_instance = _loss_func()
        self.server_path = server_path

        self.dropout_keep = .5
        self.no_sample_per_each_itr = no_sample_per_each_itr
        # self.test_path = '/srv/2-lkeb-17-dl01/syousefi/TestCode/EsophagusProject/Data-01/test/'

        self.log_ext = ''.join(map(str, self.densnet_unet_config)) + '_' + str(
            self.compression_coefficient) + '_' + str(
                self.growth_rate) + log_tag
        self.LOGDIR = server_path + Logs + self.log_ext + '/'
        self.train_acc_file = server_path + '/Accuracy/' + self.log_ext + '.txt'
        self.train_acc_file = server_path + '/Accuracy/' + self.log_ext + '.txt'
        self.validation_acc_file = server_path + '/Accuracy/' + self.log_ext + '.txt'
        self.chckpnt_dir = server_path + Logs + self.log_ext + '/densenet_unet_checkpoints/'
        self.out_path = server_path + '/Outputs/' + self.log_ext + '/'
        self.x_hist = 0

        self.tumor_percent = tumor_percent
        self.other_percent = other_percent
        self.fold = fold
    def __init__(self, data, densnet_unet_config, compression_coefficient,
                 growth_rate, sample_no, validation_samples,
                 no_sample_per_each_itr, train_tag, validation_tag, test_tag,
                 img_name, label_name, torso_tag, log_tag, tumor_percent, Logs,
                 fold, server_path):
        settings.init()

        # densenet_unet parameters
        self.densnet_unet_config = densnet_unet_config
        self.compression_coefficient = compression_coefficient
        self.growth_rate = growth_rate

        self.train_tag = train_tag
        self.validation_tag = validation_tag
        self.test_tag = test_tag
        self.img_name = img_name
        self.label_name = label_name
        self.torso_tag = torso_tag
        self.data = data
        self.learning_decay = .95
        self.learning_rate = 1E-5
        self.beta_rate = 0.05

        self.img_padded_size = 519
        self.seg_size = 505

        self.GTV_patchs_size = 49  #output patch
        self.patch_window = 63  #input patch
        self.sample_no = sample_no
        self.batch_no = 7
        self.batch_no_validation = 30
        self.validation_samples = validation_samples
        self.display_step = 100
        self.display_validation_step = 1
        self.total_epochs = 10
        self.loss_instance = _loss_func(
        )  #an instance from the class of loss functions
        self.server_path = server_path

        self.dropout_keep = .5
        self.no_sample_per_each_itr = no_sample_per_each_itr

        self.log_ext = ''.join(map(str, self.densnet_unet_config)) + '_' + str(
            self.compression_coefficient) + '_' + str(
                self.growth_rate) + log_tag
        self.LOGDIR = server_path + Logs + self.log_ext + '/'
        self.train_acc_file = server_path + '/Accuracy/' + self.log_ext + '.txt'
        self.train_acc_file = server_path + '/Accuracy/' + self.log_ext + '.txt'
        self.validation_acc_file = server_path + '/Accuracy/' + self.log_ext + '.txt'
        self.chckpnt_dir = server_path + Logs + self.log_ext + '/densenet_unet_checkpoints/'
        self.out_path = server_path + '/Outputs/' + self.log_ext + '/'
        self.x_hist = 0

        self.tumor_percent = tumor_percent
        self.fold = fold
from handlers.sell_by_trade import sell_by_trade
from handlers.sell_all_positions import sell_all_positions
from handlers.find_trigger import find_trigger
from handlers.get_level_one import get_level_one

from variables.tickers import tickers
from login.client import stream_client2, client
import login.config as config

import functions.settings as settings

import asyncio

# initialize global myDict
settings.init()


######## CREATE THE SOCKET ____________________________________________
async def read_stream():

    ### SETUP _____________________________________________________________
    await stream_client2.login()
    await stream_client2.quality_of_service(StreamClient.QOSLevel.EXPRESS)

    ### GET LEVEL ONE QUOTES specifically last_price ______________________
    await stream_client2.level_one_equity_subs(tickers)
    stream_client2.add_level_one_equity_handler(get_level_one)

    ######    ####    ### IMPORTANT TO SPECIFY #####
    ### SELL HOW????_______________________________________________________