def __init__(self, csv_file_name):

        cols = InOutSupport.read_csv_cols(file_name=csv_file_name,
                                          n_cols=3,
                                          if_ignore_first_row=True,
                                          if_convert_float=True)

        self._cohortIDs = cols[CalibrationColIndex.ID.value].astype(int)
        self._weights = cols[CalibrationColIndex.W.value]
        self._survivalProbs = cols[CalibrationColIndex.SURVIVAL_PROB.value]
        self._multiCohorts = None
Example #2
0
    def __init__(self, csv_file_name):

        # read the columns of the generated csv file containing the calibration results
        cols = InOutSupport.read_csv_cols(file_name=csv_file_name,
                                          n_cols=3,
                                          if_ignore_first_row=True,
                                          if_convert_float=True)

        # store cohort IDs, likelihood weights, and mortality probabilities
        self._cohortIDs = cols[CalibrationColIndex.ID.value].astype(int)
        self._weights = cols[CalibrationColIndex.W.value]
        self._mortalityProbs = cols[CalibrationColIndex.MORT_PROB.value]
        self._multiCohorts = None
    def __init__(self, csv_file_name):
        """ extracts seeds, mortality probabilities and the associated likelihood from
        the csv file where the calibration results are stored
        :param cvs_file_name: name of the csv file where the calibrated results are stored
        """

        # read the columns of the csv files containing the calibration results
        cols = InOutSupport.read_csv_cols(file_name=csv_file_name, n_cols = 3,
                                          if_ignore_first_row=True,
                                          if_convert_float=True)

        # store likelihood weights, cohort IDs and sampled mortality probabilities
        self._cohortIDs = cols[CalibrationColIndex.ID.value].astype(int)
        self._weights = cols[CalibrationColIndex.W.value]
        self._mortality = cols[CalibrationColIndex.MORT_PROB.value]
        self._multiCohorts = None
Example #4
0
 def __init__(self, cvs_file_name, drug_effectiveness_ratio=1):
     """ extracts seeds, mortality probabilities and the associated likelihood from
     the csv file where the calibration results are stored
     :param cvs_file_name: name of the csv file where the calibrated results are stored
     :param calibrated_model_with_drug: calibrated model simulated when drug is available
     """
     # read the columns of the csv files containing the calibration results
     cols = InOutSupport.read_csv_cols(file_name=cvs_file_name,
                                       n_cols=3,
                                       if_ignore_first_row=True,
                                       if_convert_float=True)
     # store likelihood weights, cohort IDs and sampled mortality probabilities
     self._cohortIDs = cols[CalibrationColIndex.ID.value].astype(int)
     self._weights = cols[CalibrationColIndex.W.value]
     self._mortalityProbs = cols[
         CalibrationColIndex.MORT_PROB.value] * drug_effectiveness_ratio
     self._multiCohorts = None  # multi-cohort
Example #5
0
from scr import InOutFunctions as InOutSupport

# test reading by rows
rows = InOutSupport.read_csv_rows('myCSV',
                                  if_del_first_row=True,
                                  if_convert_float=True)
print('Testing reading by rows:')
for row in rows:
    print(sum(row))

# test reading by columns
cols = InOutSupport.read_csv_cols('myCSV',
                                  n_cols=3,
                                  if_ignore_first_row=True,
                                  if_convert_float=True)
print('Testing reading by columns:')
for j in range(0, 3):
    print(sum(cols[j]))