Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions doc/CDmetaPOPhistory.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
Changes v3.09.2026.03.02.2026 ell
0) Added PopVars maturation parameters to cdclimate.
a) add _pass call to mat pars
defaultMature_pass = batchVars['mature_default'][ibatch]
mat_slope_pass = batchVars['mature_eqn_slope'][ibatch]
mat_int_pass = batchVars['mature_eqn_int'][ibatch]
b) Read in defaultMature,mat_slope,mat_int, to Preprocess, moved the tupVal in mainloop calls for sexsplit mat values. Here, just need the first values for _set, _slope and _int for each sex chromo option for initialization. Code updated in PreProcess
FXXmat_set, MXYmat_set, MYYmat_set, FYYmat_set=[val for val in process_disp(defaultMature, 0, sexchromo, defaultMature)]

# Logistic equation for maturation as a function of size - slope
FXXmat_slope,MXYmat_slope,MYYmat_slope,FYYmat_slope = [val for val in process_disp(mat_slope, 0, sexchromo, mat_slope)]

# Logistic equation for maturation as a function of size - intercept
FXXmat_int,MXYmat_int,MYYmat_int,FYYmat_int= [val for val in process_disp(mat_int, 0, sexchromo, mat_int)]
c) Next read in the _pass to cdclimate and extract the _set, _slope, and _int pars for each sexchromo option here.
defaultMature_pass,mat_slope_pass,mat_int_pass read into cdclimate, calls added to CDClimate:
FXXmat_set, MXYmat_set, MYYmat_set, FYYmat_set=[val for val in process_disp(defaultMature_pass, icdtime, sexchromo, cdclimgentime)]
FXXmat_slope,MXYmat_slope,MYYmat_slope,FYYmat_slope = [val for val in process_disp(mat_slope_pass, icdtime, sexchromo, cdclimgentime)]
FXXmat_int,MXYmat_int,MYYmat_int,FYYmat_int= [val for val in process_disp(mat_int_pass, icdtime, sexchromo, cdclimgentime)]
d) These variables read out of cdclimate and into main loop FXXmat_set, MXYmat_set, MYYmat_set, FYYmat_set,FXXmat_slope,MXYmat_slope,MYYmat_slope,FYYmat_slope,FXXmat_int,MXYmat_int,MYYmat_int,FYYmat_int


<<<<<<< Updated upstream
=======
Changes v3.08.2025.07.22 ell / A&M
Expand Down
4 changes: 2 additions & 2 deletions example_files/popvars/PopVars.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
xyfilename,mate_cdmat,matemoveno,matemoveparA,matemoveparB,matemoveparC,matemovethresh,migrateout_cdmat,migratemoveOutno,migratemoveOutparA,migratemoveOutparB,migratemoveOutparC,migratemoveOutthresh,migrateback_cdmat,migratemoveBackno,migratemoveBackparA,migratemoveBackparB,migratemoveBackparC,migratemoveBackthresh,stray_cdmat,StrayBackno,StrayBackparA,StrayBackparB,StrayBackparC,StrayBackthresh,disperseLocal_cdmat,disperseLocalno,disperseLocalparA,disperseLocalparB,disperseLocalparC,disperseLocalthresh,HomeAttempt,sex_chromo,sexans,selfans,Freplace,Mreplace,AssortativeMate_Model,AssortativeMate_Factor,mature_default,mature_eqn_slope,mature_eqn_int,offno,offans_InheritClassVars,equalClutchSize,Egg_Freq_Mean,Egg_Freq_StDev,Egg_Mean_ans,Egg_Mean_par1,Egg_Mean_par2,Egg_Mortality,Egg_Mortality_StDev,Egg_FemaleProb,startGenes,loci,alleles,muterate,mutationtype,mtdna,cdevolveans,startSelection,implementSelection,betaFile_selection,plasticgeneans,plasticSignalResponse,plasticBehavioralResponse,startPlasticgene,implementPlasticgene,cdinfect,transmissionprob,growth_option,growth_Loo,growth_R0,growth_temp_max,growth_temp_CV,growth_temp_t0,popmodel,popmodel_par1,correlation_matrix,subpopmort_file,egg_delay,egg_add,implement_disease
patchvars/PatchVars.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_CdmatrixS1.csv,1,0.01,0.01,0,max,cdmats/Patch7_Probmatrix_Dispersal.csv,9,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age6,0.0539,-6.313,2,random,N,1,1,linear,-445,3.78,N,0,0.5,0,2,2,0.5|0.25|0,random,N,N,0,Out:Back,N,N,0,0,0,Back:0,N,0,temperature,400,0.47,10.5,0.33,-0.075,packing,-0.6821,N,N,0,mating,N
patchvars/PatchVars_anadromy.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_CdmatrixS1.csv,1,0.01,0.01,0,max,cdmats/Patch7_Probmatrix_Dispersal.csv,9,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age3,0.0539,-6.313,2,random,N,1,1,linear,-445,3.78,0.62,0,0.5,0,2,2,0.5|0.25|0,random,N,N,0,Out:Back,N,N,0,0,0,Back:0,N,0,temperature,400,0.47,10.5,0.33,-0.075,anadromy,-0.6821,N,N,0,mating,N
patchvars/PatchVars.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_CdmatrixS1.csv,1,0.01,0.01,0,max,cdmats/Patch7_Probmatrix_Dispersal.csv,9,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age3|age6|age3,0.13~0.06|0.13~0.06|0.13~0.06,-20.28~-8.09|-20.28~-8.09|-20.28~-8.09,2,random,N,1,1,linear,-445,3.78,N,0,0.5,0,2,2,0,random,N,N,0,Out:Back,N,N,0,0,0,Back:0,N,0,temperature,400,0.47,10.5,0.33,-0.075,packing,-0.6821,N,N,0,mating,N
patchvars/PatchVars_anadromy.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,4,0,0,0,max~max,cdmats/Patch7_CdmatrixS1.csv,1,0.01,0.01,0,max,cdmats/Patch7_Probmatrix_Dispersal.csv,9,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,age3,0.0539,-6.313,2,random,N,1,1,linear,-445,3.78,0.62,0,0.5,0,2,2,0,random,N,N,0,Out:Back,N,N,0,0,0,Back:0,N,0,temperature,400,0.47,10.5,0.33,-0.075,anadromy,-0.6821,N,N,0,mating,N
patchvars/PatchVars.csv,cdmats/Patch7_CdmatrixS1.csv,4,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,9,0,0,0,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,9,0,0,0,max~max,cdmats/Patch7_CdmatrixS1.csv,4,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,2,0.01,0.01,0,max,mortality,2,Y,N,Y,Y,1,1,size300,0.13~0.06,-20.28~-8.09,2,random,N,1,0,exp,126.07,0.0061,0.62,0.18,0.5,0,2,2,0,random,N,N,0,Eggs,N,N,0,0,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,logistic_back,-0.6821,N,N,0,mating,N
patchvars/PatchVars.csv,cdmats/Patch7_CdmatrixS1.csv,6,1.346,202.4846,6,6000,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,9,0,0,0,max~max,cdmats/Patch7_Probmatrix_onewayBarriersXRiverineS1.csv,9,0,0,0,max~max,cdmats/Patch7_CdmatrixS1.csv,2,0.01,0.01,0,max,cdmats/Patch7_CdmatrixS1.csv,2,0.01,0.01,0,max,mortality,2,H,0.5,Y,Y,1,1,N,0.13~0.06,-20.28~-8.09,2,random,N,0.5,0.1,exp,126.07,0.0061,0,0,0.5,0,2,2,0,random,N,N,0,Back,N,N,0,0,0,Back,N,1.5,temperature,250,0.57,12,0.25,-0.196,N,-0.6821,N,N,0,mating,N
26 changes: 20 additions & 6 deletions src/CDmetaPOP_PreProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,12 +1099,12 @@ def ReadXY(xyfilename):
#End::ReadXY()

# ---------------------------------------------------------------------------------------------------
def DoCDClimate(datadir,icdtime,cdclimgentime,matecdmatfile,dispOutcdmatfile,dispBackcdmatfile,straycdmatfile,matemoveno_pass,dispmoveOutno,dispmoveBackno,StrBackno,matemovethresh,dispmoveOutthresh,dispmoveBackthresh,StrBackthresh,matemoveparA,matemoveparB,matemoveparC,dispmoveOutparA,dispmoveOutparB,dispmoveOutparC,dispmoveBackparA,dispmoveBackparB,dispmoveBackparC,StrBackparA,StrBackparB,StrBackparC,MgOut_patch_prob,Str_patch_prob,K,outsizevals,backsizevals,outgrowdays,backgrowdays,fitvals,popmort_back,popmort_out,eggmort,Kstd,popmort_back_sd,popmort_out_sd,eggmort_sd,outsizevals_sd,backsizevals_sd,outgrowdays_sd,backgrowdays_sd,pop_capture_back,pop_capture_out,cdevolveans,N0_pass,allefreqfiles_pass,classvarsfiles_pass,assortmateModel_pass,assortmateC_pass,subpopmort_pass,PopTag,dispLocalcdmatfile,dispLocalno,dispLocalparA,dispLocalparB,dispLocalparC,dispLocalthresh,comp_coef_pass,betaFile_selection,xvars_betas_pass,outhabvals_pass,backhabvals_pass,plastic_signalresp_pass,plastic_behaviorresp_pass,plasticans,muterate_pass,sexchromo,MgBack_patch_prob,Disperse_patch_prob,alldiseaseVars_files,implementdisease,pathogen_load,disease_fitvals_pass):
def DoCDClimate(datadir,icdtime,cdclimgentime,matecdmatfile,dispOutcdmatfile,dispBackcdmatfile,straycdmatfile,matemoveno_pass,dispmoveOutno,dispmoveBackno,StrBackno,matemovethresh,dispmoveOutthresh,dispmoveBackthresh,StrBackthresh,matemoveparA,matemoveparB,matemoveparC,dispmoveOutparA,dispmoveOutparB,dispmoveOutparC,dispmoveBackparA,dispmoveBackparB,dispmoveBackparC,StrBackparA,StrBackparB,StrBackparC,MgOut_patch_prob,Str_patch_prob,K,outsizevals,backsizevals,outgrowdays,backgrowdays,fitvals,popmort_back,popmort_out,eggmort,Kstd,popmort_back_sd,popmort_out_sd,eggmort_sd,outsizevals_sd,backsizevals_sd,outgrowdays_sd,backgrowdays_sd,pop_capture_back,pop_capture_out,cdevolveans,N0_pass,allefreqfiles_pass,classvarsfiles_pass,assortmateModel_pass,assortmateC_pass,subpopmort_pass,PopTag,dispLocalcdmatfile,dispLocalno,dispLocalparA,dispLocalparB,dispLocalparC,dispLocalthresh,comp_coef_pass,betaFile_selection,xvars_betas_pass,outhabvals_pass,backhabvals_pass,plastic_signalresp_pass,plastic_behaviorresp_pass,plasticans,muterate_pass,sexchromo,MgBack_patch_prob,Disperse_patch_prob,alldiseaseVars_files,implementdisease,pathogen_load,disease_fitvals_pass,defaultMature_pass,mat_slope_pass,mat_int_pass):
'''
DoCDCliamte()
Reads in cost distance matrices and converts to probabilities.
'''

# -------------------------------
# Extract cdclimate values here
# -------------------------------
Expand Down Expand Up @@ -1351,6 +1351,11 @@ def DoCDClimate(datadir,icdtime,cdclimgentime,matecdmatfile,dispOutcdmatfile,dis
# Add Beta0
tempbetas_selection.append(0.0 if not betavals[0][0] else float(betavals[0][0]))

# Maturation values - split by sexchromo possible - _set, _slope, _int
FXXmat_set, MXYmat_set, MYYmat_set, FYYmat_set=[val for val in process_disp(defaultMature_pass, icdtime, sexchromo, cdclimgentime)]
FXXmat_slope,MXYmat_slope,MYYmat_slope,FYYmat_slope = [val for val in process_disp(mat_slope_pass, icdtime, sexchromo, cdclimgentime)]
FXXmat_int,MXYmat_int,MYYmat_int,FYYmat_int= [val for val in process_disp(mat_int_pass, icdtime, sexchromo, cdclimgentime)]

# ----------------------
# Patch based parameters
# ----------------------
Expand Down Expand Up @@ -1489,7 +1494,7 @@ def DoCDClimate(datadir,icdtime,cdclimgentime,matecdmatfile,dispOutcdmatfile,dis
FXXdispmoveBackno,MXYdispmoveBackno,MYYdispmoveBackno,FYYdispmoveBackno,\
FXXStrno,MXYStrno,MYYStrno,FYYStrno,\
FXXdispLocalno,MXYdispLocalno,MYYdispLocalno,FYYdispLocalno,\
tempMgOut_patch_prob,tempStr_patch_prob,tempoutsize,tempbacksize,tempoutgrow,tempbackgrow,tempfitvals,tempK,temppopmort_back,temppopmort_out,tempeggmort,tempKstd,temppopmort_back_sd,temppopmort_out_sd,tempeggmort_sd,tempoutsize_sd,tempbacksize_sd,tempoutgrow_sd,tempbackgrow_sd,temppopCapBack,temppopCapOut,tempN0,tempAllelefile,tempClassVarsfile,assortmateModel, assortmateC,subpopmort_mat,tempcompcoef,tempbetas_selection,tempxvars_betas,tempouthabvals,tempbackhabvals,plastic_signalresp,plastic_behaviorresp,muterate,age_percmort_out,age_percmort_out_sd,age_percmort_back,age_percmort_back_sd,size_percmort_out,size_percmort_out_sd,size_percmort_back,size_percmort_back_sd,age_MgOUT,age_MgBACK,age_S,age_DispProb,age_mature,age_mu,age_sigma,f_leslie,f_leslie_std,age_cap_out,age_cap_back,tempMgBack_patch_prob,tempDisperse_patch_prob,tupDisease_Vars
tempMgOut_patch_prob,tempStr_patch_prob,tempoutsize,tempbacksize,tempoutgrow,tempbackgrow,tempfitvals,tempK,temppopmort_back,temppopmort_out,tempeggmort,tempKstd,temppopmort_back_sd,temppopmort_out_sd,tempeggmort_sd,tempoutsize_sd,tempbacksize_sd,tempoutgrow_sd,tempbackgrow_sd,temppopCapBack,temppopCapOut,tempN0,tempAllelefile,tempClassVarsfile,assortmateModel, assortmateC,subpopmort_mat,tempcompcoef,tempbetas_selection,tempxvars_betas,tempouthabvals,tempbackhabvals,plastic_signalresp,plastic_behaviorresp,muterate,age_percmort_out,age_percmort_out_sd,age_percmort_back,age_percmort_back_sd,size_percmort_out,size_percmort_out_sd,size_percmort_back,size_percmort_back_sd,age_MgOUT,age_MgBACK,age_S,age_DispProb,age_mature,age_mu,age_sigma,f_leslie,f_leslie_std,age_cap_out,age_cap_back,tempMgBack_patch_prob,tempDisperse_patch_prob,tupDisease_Vars,FXXmat_set, MXYmat_set, MYYmat_set, FYYmat_set,FXXmat_slope,MXYmat_slope,MYYmat_slope,FYYmat_slope,FXXmat_int,MXYmat_int,MYYmat_int,FYYmat_int

return tupClimate
# End::DoCDClimate()
Expand Down Expand Up @@ -1800,7 +1805,7 @@ def DoStochasticUpdate(K_mu,K_std,popmort_back_mu,popmort_back_sd,popmort_out_mu
#End::DoStochasticUpdate()

# ---------------------------------------------------------------------------------------------------
def DoPreProcess(outdir,datadir,irun,ithmcrun,xyfilename,loci,alleles,gen,logfHndl,cdevolveans,subpopemigration,subpopimmigration,sizeans,burningen_cdevolve,cor_mat_ans,inheritans_classfiles,sexans,spcNO,ibatch,betaFile_selection,FXXmat_set,FXXmat_int,FXXmat_slope,MXYmat_set,MXYmat_int,MXYmat_slope,MYYmat_set,MYYmat_int,MYYmat_slope,FYYmat_set,FYYmat_int,FYYmat_slope,sexchromo,eggFreq_mu,eggFreq_sd,implementdisease):
def DoPreProcess(outdir,datadir,irun,ithmcrun,xyfilename,loci,alleles,gen,logfHndl,cdevolveans,subpopemigration,subpopimmigration,sizeans,burningen_cdevolve,cor_mat_ans,inheritans_classfiles,sexans,spcNO,ibatch,betaFile_selection,defaultMature,mat_slope,mat_int,sexchromo,eggFreq_mu,eggFreq_sd,implementdisease):

'''
DoPreProcess()
Expand Down Expand Up @@ -1915,9 +1920,18 @@ def DoPreProcess(outdir,datadir,irun,ithmcrun,xyfilename,loci,alleles,gen,logfHn
cor_mat = np.asarray(np.asarray(cor_mat)[1:,1:],dtype='float')

# -----------------------------------------------------------------------------
# Extract variables needed for initialization that vary with cdclimategen (bar)
# Extract variables needed for initialization that vary with cdclimategen (bar)
# -----------------------------------------------------------------------------
#pdb.set_trace()

# Check Deterministic mature set value either age or size - split by bar and sex options, icdtime = 0 and length of cdclimate just needs to match the split par length
FXXmat_set, MXYmat_set, MYYmat_set, FYYmat_set=[val for val in process_disp(defaultMature, 0, sexchromo, defaultMature)]

# Logistic equation for maturation as a function of size - slope
FXXmat_slope,MXYmat_slope,MYYmat_slope,FYYmat_slope = [val for val in process_disp(mat_slope, 0, sexchromo, mat_slope)]

# Logistic equation for maturation as a function of size - intercept
FXXmat_int,MXYmat_int,MYYmat_int,FYYmat_int= [val for val in process_disp(mat_int, 0, sexchromo, mat_int)]

K, Kstd, pop_capture_back, N0, allefreqfiles, classvarsfiles, tempdiseaseVarsfile = [],[],[],[],[],[],[]
for isub in range(len(K_temp)):
mu = int(K_temp[isub].split('|')[0])
Expand Down
Loading