StockFunctions module

author: Young

AfoLogic.StockFunctions.f_birthweight_cs(cx, w_b_yatf, w_f_dams, period_is_birth)
AfoLogic.StockFunctions.f_birthweight_mu(cu1, cb1, cg, cx, ce, w_b, cf_w_b_dams, ffcfw_birth_dams, ebg_dams, days_period, gest_propn, period_between_joinscan, period_between_scanbirth, period_is_birth)
AfoLogic.StockFunctions.f_chill_cs(cc, ck, ffcfw_start, rc_start, sl_start, mei, meme, mew, new, km, kg_supp, kg_fodd, mei_propn_supp, mei_propn_herb, temp_ave_a1e1b1nwzida0e0b0xyg, temp_max_a1e1b1nwzida0e0b0xyg, temp_min_a1e1b1nwzida0e0b0xyg, ws_a1e1b1nwzida0e0b0xyg, rain_a1e1b1nwzida0e0b0xygp1, index_m0, guw=0, kl=0, mei_propn_milk=0, mec=0, mel=0, nec=0, nel=0, gest_propn=0, lact_propn=0)
AfoLogic.StockFunctions.f_conception_cs(cf, cb1, relsize_mating, rc_mating, cpg_doy, nfoet_b1any, nyatf_b1any, period_is_mating, index_e1, rev_trait_value, saa_rr, sam_rr)

‘ Calculation of dam conception using CSIRO equation system

Conception is the change in the numbers of animals in each slice of e & b as a proportion of the numbers in the NM slice (e[0]b[0]). The adjustment of the actual numbers occurs in f1_period_end_nums(). This function calculates the change in the proportions (the total should add to 0)

The general approach is to calculate the probability of conception greater than or equal to 1,2,3 foetuses Probability is calculated from a sigmoid relationship based on relative size * relative condition at joining The estimation of cumulative probability is scaled by a factor that varies with day of year that changes with litter size & latitude. The probability is an estimate of the number of dams carrying that number in the third trimester (or birth). Some dams conceive (and don’t return to service) but don’t carry to the third trimester due to abortion, this is taken into account. The values are altered by a sensitivity analysis on scanning percentage Conception (proportion of dams that are dry) and litter size (number of foetuses per pregnant dam) can be controlled for relative economic values

Parameters:
  • cf

  • cb1 – GrazPlan parameter stating the probability of conception with different number of foetuses.

  • relsize_mating – Relative size at mating. This is a separate variable to relsize_start because mating may occur mid period. Note: the e and b axis have been handled before passing in.

  • rc_mating – Relative condition at mating. This is a separate variable to rc_start because mating may occur mid period. Note: the e and b axis have been handled before passing in.

  • cpg_doy – A scalar for the proportion of dry, single, twins & triplets based on day of the year.

  • nfoet_b1any

  • nyatf_b1any

  • period_is_mating

  • index_e1

  • rev_trait_value

  • saa_rr

Returns:

Dam conception.

AfoLogic.StockFunctions.f_conception_ltw(cf, cu0, relsize_mating, cs_mating, scan_std, doy_p, rr_doy, nfoet_b1any, nyatf_b1any, period_is_mating, index_e1, rev_trait_value)

Conception is the change in the numbers of animals in each slice of e & b as a proportion of the numbers in the NM slice (e[0]b[0]). The adjustment of the actual numbers occurs in f1_period_end_nums() This function calculates the change in the proportions (the total should add to 0)

LTW system: The general calculation is scanning percentage is defined by a linear function of CS The standard value (CS 3) is determined by the genotype, relative size and adjusted based on day of the year. The slope with which RR is adjusted if CS is different from CS3 varies with day of year. The proportion of dry, single, twin & triplet is estimated as a function of the scanning percentage using f1_DSTw The proportion of ewes that implant but don’t retain to the third trimester is accounted for. Note: sa is not applied in this function because it is applied to the input scan_std (which is also used to determine the BTRT effect on fleece)

Parameters:
  • relsize_mating – Relative size at mating. This is a separate variable to relsize_start because mating may occur mid period. Note: the e and b axis have been handled before passing in.

  • cs_mating – Condition score at mating. Note: the e and b axis have been handled before passing in.

  • rr_doy – A scalar for reproductive rate based on day of the year. Based on GrazPlan cpg_doy relationship

AfoLogic.StockFunctions.f_conception_mu2(cf, cb1, cu2, srw, maternallw_mating, lwc, age, nlb, doj, doj2, lat, nfoet_b1any, nyatf_b1any, period_is_mating, rev_trait_value, saa_rr, sam_rr, saa_ls, saa_con, saa_preg_increment)

‘ Calculation of dam conception using a back transformed logistic function. Using coefficients developed in Murdoch University trials that mated for 2 cycles.

Conception is the change in the numbers of animals in each slice of e & b as a proportion of the numbers in the NM slice (e[0]b[0]). The adjustment of the actual numbers occurs in f1_period_end_nums() This function calculates the change in the proportions (the total should add to 0)

The general approach is to calculate the probability of conception less than or equal to 1,2,3 foetuses similar to f_conception_cs() except LMAT is “less than” and probability is calculated from a back transformed calculation with linear and quadratic terms. The calculation includes terms for LW at joining, Age at joining and LW change during joining. The estimation of cumulative probability as fitted in the LMAT trial is scaled by a day of year factor, this is derived from the factor used for the GrazPlan adjustment but requires calculating in this function. The probability is an estimate of the number of dams carrying that number of young to birth if mated for the number of cycles assessed in the trial. The parameters could be altered to represent a single cycle however this correction hasn’t been made (as of Apr 2022) and the adjustment is made in this function. Some dams conceive (and don’t return to service) but don’t carry to birth (the third trimester) due to abortion during pregnancy, this is taken into account. #todo The conversion of the prediction from 2 cycles back to one cycle doesn’t include this loss # which then increases the proportion of empty ewes and reduces the expected RR. # The correction has been removed for now. The values are altered by a sensitivity analysis on scanning percentage, litter size and conception Conception (proportion of dams that are dry) and litter size (number of foetuses per pregnant dam) can be controlled for relative economic values

Parameters:
  • cf – Includes parameter for number of ewes that implant but don’t retain to birth (the 3rd trimester).

  • cb1 – Cut-off parameter for the probability of conception with different number of foetuses (remember the NM slice in b1)

  • cu2 – LMAT parameters controlling impact of LWJ, LWC during joining, NLB, Age at joining

  • srw – Standard reference weight of the dam genotype, not including the adjustment assoicated with BTRT

  • maternallw_mating – Maternal LW at mating. Allows that mating may occur mid-period. Note: the e and b axis have been handled before passing in.

  • lwc – Liveweight change of the dam during the generator period in g/hd/d.

  • age – age of dam mid-period in days. Indexed for p. The i axis can be non-singleton

  • nlb – Number of lambs born ASBV - mid-parent average (achieved by using nlb_g3).

  • doj – The average day of joining for the dams mated in this oestrus cycle. This represents seasonality of reproduction

  • doj2 – The average of the square of the day of joining for the dams mated in this oestrus cycle. This represents seasonality of reproduction

  • lat – Latitude of the location (in degrees). Which affects reproduction. Calibrated for range -28.5 to -34.6 (although it should work down to -37.6 for Hamilton)

  • nfoet_b1any – Number of foetuses = number of lambs born

  • nyatf_b1any – Number of lambs surviving the peri-natal period.

  • period_is_mating – Dams are mated in this generator period

  • rev_trait_value

  • saa_rr

  • sam_rr – combine sam on reproductive rate

  • saa_con

  • saa_ls

  • saa_preg_increment

Returns:

Dam conception. Proportion of dams that conceive 0,1,2 or 3 for this oestrus cycle. Conceiving 0 means falls pregnant but loses the embryo after the joining period has ended (so can’t be remated)

AfoLogic.StockFunctions.f_emissions_bc(ch, intake_f, intake_s, md_solid, level)
AfoLogic.StockFunctions.f_energy_cs(ck, cx, cm, lw_start, ffcfw_start, mr_age, mei, omer_history_start, days_period, md_solid, i_md_supp, md_herb, lgf_eff, dlf_eff, i_steepness, density, foo, confinement, intake_f, dmd, mei_propn_milk=0, sam_kg=1, sam_mr=1)
AfoLogic.StockFunctions.f_fibre(cw_g, cc_g, ffcfw_start_g, relsize_start_g, d_cfw_history_start_p2g, mei_g, mew_min_g, d_cfw_ave_g, sfd_a0e0b0xyg, wge_a0e0b0xyg, af_wool_g, dlf_wool_g, kw_yg, days_period_g, sfw_ltwadj_g, sfd_ltwadj_g, rev_trait_value, mec_g1=0, mel_g1=0, gest_propn_g1=0, lact_propn_g1=0, sam_pi=1)
AfoLogic.StockFunctions.f_foetus_cs(cp, cb1, kc, nfoet, relsize_start, rc_start, w_b_std_y, w_f_start, nw_f_start, nwf_age_f, guw_age_f, dce_age_f)
AfoLogic.StockFunctions.f_husbandry(head_adjust, mobsize_pg, o_ffcfw_tpg, o_cfw_tpg, operations_triggerlevels_h5h7h2tpg, index_pg, age_start, period_is_shear_pg, period_is_wean_pg, gender, o_ebg_tpg, wool_genes, husb_operations_muster_propn_h2tpg, husb_requisite_cost_h6tpg, husb_operations_requisites_prob_h6h2tpg, operations_per_hour_l2h2tpg, husb_operations_infrastructurereq_h1h2tpg, husb_operations_contract_cost_h2tpg, husb_muster_requisites_prob_h6h4tpg, musters_per_hour_l2h4tpg, husb_muster_infrastructurereq_h1h4tpg, a_t_g=array([0]), a_nyatf_b1g=0, period_is_joining_pg=False, animal_mated=False, scan_option=0, period_is_endmating_pg=False, dtype=None)
AfoLogic.StockFunctions.f_intake(pi, ri, md_herb, confinement, intake_s, i_md_supp, mp2=0)
AfoLogic.StockFunctions.f_lwc_cs(cg, rc_start, mei, mem, mew, zf1, zf2, kg, rev_trait_value, mec=0, mel=0, gest_propn=0, lact_propn=0)
AfoLogic.StockFunctions.f_lwc_mu(cg, rc_start, mei, mem, mew, zf1, zf2, kg, rev_trait_value, mec=0, mel=0, gest_propn=0, lact_propn=0)
AfoLogic.StockFunctions.f_milk(cl, srw, relsize_start, rc_birth_start, mei, meme, mew_min, rc_start, ffcfw75_exp_yatf, lb_start, ldr_start, age_yatf, mp_age_y, mp2_age_y, i_x_pos, days_period_yatf, kl, lact_nut_effect)
AfoLogic.StockFunctions.f_mortality_base_cs(cd, cg, rc_start, cv_weight, ebg_start, sd_ebg, d_nw_max, days_period, rev_trait_value, sap_mortalityb)
AfoLogic.StockFunctions.f_mortality_base_mu(cd, cg, rc_start, cv_weight, ebg_start, sd_ebg, d_nw_max, days_period, rev_trait_value, sap_mortalityb)
AfoLogic.StockFunctions.f_mortality_dam_cs()

Peri natal (at birth) Dam mortality. Currently, the CSIRO system includes dam mortality due to PregTox (f_mortality_pregtox_cs) and dam mortality due to dystocia (included in f_mortality_progeny_cs) but there is no calculation of deaths from other causes, such as those that might affect twin & triplet bearing dams at birth.

AfoLogic.StockFunctions.f_mortality_dam_mu(cu2, ce, cb1, cs, cv_cs, period_is_birth, nfoet_b1, saa_mortalitye)
AfoLogic.StockFunctions.f_mortality_dam_mu2(cu2, ce, cb1, cf_csc, csc, cs, cv_cs, period_between_scanprebirth, period_is_prebirth, nfoet_b1, days_period, saa_mortalitye)

Peri natal Dam mortality due to: CS at birth, CS change scanning to pre lambing, birth type & age of the dam. The mortality is incurred at the pre-birth period and can’t be incurred each period because of the back transformation.

AfoLogic.StockFunctions.f_mortality_pregtox_cs(cb1, cg, nw_start, ebg, sd_ebg, days_period, period_is_pregtox, gest_propn, saa_mortalitye)

(Twin) Dam mortality in last 6 weeks (preg tox). This increments mortality associated with LWL in the base mortality function.

Preg tox is short for pregnancy toxaemia. It is associated with ketosis where the ewe switches into burning fat (rather than carbohydrates) because they are losing weight. It is predominantly a problem for multiple bearing ewes because they have the highest energy demands close to lambing and the least capacity to eat more (because stomach capacity is restricted due to the volume of the conceptus). It is usually also more of a problem for ewes that start out in better condition.

AfoLogic.StockFunctions.f_mortality_pregtox_mu(cb1, cg, nw_start, ebg, sd_ebg, days_period, period_is_pregtox, gest_propn)

Mortality of multiple bearing dams in late pregnancy. This increments mortality associated with LWL in the base mortality function.

This is a copy of the CSIRO function except that the period has been reduced because the MU relationships include ewe mortality associated with loss of CS from scanning to pre-lambing (about day 135). The CSIRO Preg Tox relationship is only active after that point instead of for the full 6 week period in f_mortality_pregtox_cs(). The saa on ewe mortality has been removed because it has been applied in the pre-lambing calculation.

Preg tox is short for pregnancy toxaemia. It is associated with ketosis where the ewe switches into burning fat (rather than carbohydrates) because they are losing weight. It is predominantly a problem for multiple bearing ewes because they have the highest energy demands close to lambing and the least capacity to eat more (because stomach capacity is restricted due to the volume of the conceptus). It is usually also more of a problem for ewes that start out in better condition.

AfoLogic.StockFunctions.f_mortality_progeny_cs(cd, cb1, w_b, rc_birth, cv_weight, w_b_exp_y, period_is_birth, chill_index_p1, nfoet_b1, rev_trait_value, sap_mortalityp, saa_mortalityx)

Progeny losses due to large progeny or slow birth process (dystocia)

Dystocia definition is a difficult birth that leads to brain damage, which can be due to physical trauma but also lack of oxygen. The difficult birth can be a larger single lamb but it is also quite prevalent in twins not due to large lambs but due to a slow birth because the ewe is lacking energy to push.

AfoLogic.StockFunctions.f_mortality_progeny_mu(cu2, cb1, cx, ce, w_b, w_b_std, cv_weight, foo, chill_index_p1, mob_size, period_is_birth, rev_trait_value, sap_mortalityp, saa_mortalityx)

Calculate the mortality of progeny at birth due to mis-mothering and exposure using the LTW & LMAT prediction equations (Oldham et al. 2011) with inclusion of chill index, FOO and mob size. Uses BW as a proportion of SRW (which is passed as the w_b argument)

# Removed - The paddock level scalar is added (Young et al 2011) however, this is not calibrated for high chill environments (>1000) # The scalar adjusts the difference in survival if birth weight is different from the standard birthweight # this is to reflect the difference in survival observed in the LTW paddock trial compared with the plot scale trials.

AfoLogic.StockFunctions.f_mortality_weaner_cs(cd, cg, age, ebg_start, sd_ebg, d_nw_max, days_period)
AfoLogic.StockFunctions.f_mortality_weaner_mu(cu2, ce=0)
AfoLogic.StockFunctions.f_potential_intake_cs(ci, cl, srw, relsize_start, rc_start, temp_lc, temp_ave, temp_max, temp_min, rain_intake, rc_birth_start=1, pi_age_y=0, lb_start=0, mp2=0, piyf=1, period_between_birthwean=1, sam_pi=1)
Parameters:
  • ci

  • cl

  • srw

  • relsize_start

  • rc_start

  • temp_lc_dams

  • temp_ave

  • temp_max

  • temp_min

  • rain_intake

  • rc_birth_start

  • pi_age_y

  • lb_start

  • mp2

  • piyf

  • period_between_birthwean

  • sam_pi – sensitivity multiplier on PI. Applied as an intermediate SAM so that it can be differentially applied by age

Return pi:

AfoLogic.StockFunctions.f_potential_intake_mu(srw)
AfoLogic.StockFunctions.f_progenycfw_mu(cu1, cg, cfw_adj, cf_cfw_dams, ffcfw_birth_dams, ffcfw_birth_std_dams, ebg_dams, days_period, gest_propn, period_between_mated90, period_between_d90birth, period_is_birth)
AfoLogic.StockFunctions.f_progenyfd_mu(cu1, cg, fd_adj, cf_fd_dams, ffcfw_birth_dams, ffcfw_birth_std_dams, ebg_dams, days_period, gest_propn, period_between_mated90, period_between_d90birth, period_is_birth)
AfoLogic.StockFunctions.f_sale_value(cn, cx, o_rc_tpg, o_ffcfw_tpg, dressp_adj_yg, dresspercent_adj_s6tpg, dresspercent_adj_s7tpg, grid_price_s7s5s6tpg, price_scalar_c1s7tpg, month_scalar_s7tpg, month_discount_s7tpg, price_type_s7tpg, cvlw_s7s5tpg, cvscore_s7s6tpg, grid_weightrange_s7s5tpg, grid_scorerange_s7s6tpg, age_end_pg1, discount_age_s7tpg, sale_cost_pc_s7tpg, sale_cost_hd_s7tpg, mask_s7x_s7tpg, sale_agemax_s7tpg1, sale_agemin_s7tpg1, sale_ffcfw_min_s7tpg, sale_ffcfw_max_s7tpg, mask_s7g_s7tpg, dtype=None)
AfoLogic.StockFunctions.f_sire_req(sire_propn_a1e1b1nwzida0e0b0xyg1g0, sire_periods_g0p8, i_sire_recovery, date_end_p, period_is_prejoin_a1e1b1nwzida0e0b0xyg1)
AfoLogic.StockFunctions.f_treatment_unit_numbers(head_adjust, mobsize_pg, o_ffcfw_pg, o_cfw_pg, a_nyatf_b1g=0)
AfoLogic.StockFunctions.f_wbe(aw, mw, cg)
AfoLogic.StockFunctions.f_weanweight_cs(w_w_yatf, ffcfw_start_yatf, ebg_yatf, days_period, period_is_wean)
AfoLogic.StockFunctions.f_weanweight_mu(cu1, cb1, cg, cx, ce, nyatf, w_w, cf_w_w_dams, ffcfw_wean_dams, ebg_dams, foo, foo_ave_start, days_period, day_of_lactation, period_between_joinscan, period_between_scanbirth, period_between_birthwean, period_is_wean)
AfoLogic.StockFunctions.f_wool_additional(fd, sl, ss, vm, pmb, cvfd=0.22, cvsl=0.18)
AfoLogic.StockFunctions.f_wool_value(stb_mpg_w4, wool_price_scalar_c1w4tpg, cfw_pg, fd_pg, sl_pg, ss_pg, vm_pg, pmb_pg, dtype=None)

Calculate the net value of the wool on the sheep’s back (cost of shearing is not included in these calculations) Includes adjusting price for FD, level of fault (VM & predicted hauteur) and all components of the clip (STB) FNF is ‘free or nearly free’ i.e. wool with no fault (low VM & high SS) STB is sweep the board i.e. including all the wool types that are produced (fleece, pieces, bellies …) NIB is net in the bank i.e. all selling, testing & freight costs removed