def rnd_numbers(self): if self.distr.upper() == 'T': rd = generate_rnd_numbers_triangular\ ( self.min, self.mp, self.max, n_repetitions ) return rd elif self.distr.upper() == 'U': rd = generate_rnd_numbers_uniform \ ( self.min, self.max, n_repetitions ) return rd elif self.distr.upper() == 'F': # fixed value is actually a triangular distribution with a very low variation rd = generate_rnd_numbers_triangular \ ( self.mp * .9999999999, self.mp, self.mp * 1.000000001, n_repetitions ) return rd else: exit_app('error')
def user_selection(self): # split DF according the genetic line user selection try: selected_df = self.df[self.df['genetic_ident'] == self.user_input] except Exception(): exit_app('Error creating selected DF - Aborted process') else: return selected_df
rnd_other_earn_per_bird = other_earn.rnd_numbers() # print(rnd_feed_cost_gr_of_feed) # print(rnd_feed_cost_gr_of_feed) # print(rnd_vet_cost_per_bird) # print(rnd_other_cost_per_bird) # print(rnd_brown_egg_price_per_kg) # print(rnd_pullet_cost) # print(rnd_other_earn_per_bird) # print(rnd_additive_cost_gr_of_feed) # read CSV file try: layer_df = pd.read_csv(csv_file_name) # main df except FileNotFoundError: exit_app(error_msn['file_not_found']) except Exception(): exit_app(error_msn['open_file_error']) else: print(f'CSV file {csv_file_name} was open\n') # select the layer genetics from the DF genetic_options = layer_df['genetic_ident'].unique() print('\n' + other_msn['user_genetic_options_msn']) for i in range(len(genetic_options)): print(f'Option [{i}] = {genetic_options[i]}') # user input about layer breed (genetics) genetic_user_selection = int(input(' ? (type 10 to exit)')) if genetic_user_selection == 10:
def user_type_error(): test_feed = VerifyUserInput\ ( cost_setup["feed_cost_ton_mim"], cost_setup["feed_cost_ton_mp"], cost_setup["feed_cost_ton_max"], ) if not bool(test_feed.var_input_check()): exit_app(error_msn['input_err_feed_cost']) test_pullet = VerifyUserInput \ ( cost_setup["pullet_cost_mim"], cost_setup["pullet_cost_mp"], cost_setup["pullet_cost_max"], ) if not bool(test_pullet.var_input_check()): exit_app(error_msn['input_err_pullet_cost']) test_additive = VerifyUserInput \ ( cost_setup["additive_cost_ton_mim"], cost_setup["additive_cost_ton_mp"], cost_setup["additive_cost_ton_max"], ) if not bool(test_additive.var_input_check()): exit_app(error_msn['input_err_additive_cost']) test_vet = VerifyUserInput \ ( cost_setup["vet_cost_month_mim"], cost_setup["vet_cost_month_mp"], cost_setup["vet_cost_month_max"], ) if not bool(test_vet.var_input_check()): exit_app(error_msn['input_err_vet_cost']) test_white_egg = VerifyUserInput \ ( egg_market['white_std_egg_price_min'], egg_market['white_std_egg_price_mp'], egg_market['white_std_egg_price_max'], ) if not bool(test_white_egg.var_input_check()): exit_app(error_msn['input_err_white_egg_price']) test_brown_egg = VerifyUserInput \ ( egg_market['brown_std_egg_price_min'], egg_market['brown_std_egg_price_mp'], egg_market['brown_std_egg_price_max'], ) if not bool(test_brown_egg.var_input_check()): exit_app(error_msn['input_err_brown_egg_price']) other_earn = VerifyUserInput \ ( egg_market['other_earning_month_min'], egg_market['other_earning_month_mp'], egg_market['other_earning_month_max'], ) if not bool(test_brown_egg.var_input_check()): exit_app(error_msn['input_err_other_earning'])
begg[0] = (egg_market['brown_std_egg_price_min'] \ / egg_market['sale_unit']) / egg_kg begg[1] = egg_market['brown_std_egg_price_mp'] \ / egg_market['sale_unit'] / egg_kg \ begg[2] = egg_market['brown_std_egg_price_max'] \ / egg_market['sale_unit'] / egg_kg begg[3] = egg_market['brown_std_egg_price_distr'] return begg elif self.parameter.lower() == 'other_earn': other_earn = [None] * 4 other_earn[0] = egg_market["other_earning_month_min"] \ / app_setup_parameters['weeks_per_month'] \ / farm_setup['number_of_layers'] other_earn[1] = egg_market["other_earning_month_mp"] \ / app_setup_parameters['weeks_per_month'] \ / farm_setup['number_of_layers'] other_earn[2] = egg_market["other_earning_month_max"] \ / app_setup_parameters['weeks_per_month'] \ / farm_setup['number_of_layers'] other_earn[3] = egg_market["other_earning_month_distr"] return other_earn else: exit_app('Error on convertion')