def test_log_likelihood_coupled(self): """Tests that log_likelihood_coupled function returns a reasonable estimate""" test_params = [0.03178564, 0.00310762, 0.00017541, 0.00022762] path = io.get_data_file_path('simulated_coupled_6x6.pkl') testdata = celldensity.CellDen(pd.read_pickle(path)) mu_n = -0.15 sigma_n = 0.1 val = model.log_likelihood_coupled(test_params, testdata, mu_n, sigma_n) np.testing.assert_almost_equal(val, -10289.069087654105, 4)
def read(data_file, CellA, CellB, BinDiv, ImgWidth=1024, time_scale=0.25, length_scale=1.33): ''' Parameters: ----------- data_file: the .csv file containing the data with the following columns Identity Labeling: Column 0:'ImageNumber': denoting the time step image Column 1: 'ObjectNumber': denoting the arbitrary identity of the cell Intensity classifications: 'Classify_Intensity_UpperQuartileIntensity_CellA_high_Intensity_UpperQuartileIntensity_CellB_high' 'Classify_Intensity_UpperQuartileIntensity_CellA_high_Intensity_UpperQuartileIntensity_CellB_low' 'Classify_Intensity_UpperQuartileIntensity_CellA_low_Intensity_UpperQuartileIntensity_CellB_high' 'Classify_Intensity_UpperQuartileIntensity_CellA_low_Intensity_UpperQuartileIntensity_CellB_low' where the order of CellA and CellB should be the same as that of the input parameter Locations: 'Location_Center_X' 'Location_Center_Y' CellA: Name of the first cell type, e.g.'Sox2' CellB: Name of the second cell type, e.g. 'Oct4' BinDiv: An integer telling the function to divide the orginal cell image into BinDiv x BinDiv bins ImgWidth: the width dimension of the image in pixels (e.g. for an image of 1024x1024, just enter 1024) time_scale: time scale of each time step between subsequent images, in hours length_scale: linear size scale of the image, in mm Returns: ----------- An object with the following attributes: CellDen.data: A dataframe with the density of different types of cells in the bins of the original cell image at different time t.The format of the output dataframe would be like -- Rows-> time index Main Column-> cell types Sub Column-> bin index CellDen.cellname: a tuple of the first and second cell name CellDen.bin_num: total bin number CellDen.tot_time: total time step of the experiment CellDen.time_scale: time scale between subsequent time steps, in hours CellDen.length_scale: linear size scale of the image, in mm ''' data = celldensity.cell_density(data_file, CellA, CellB, BinDiv, ImgWidth) return celldensity.CellDen(data, time_scale, length_scale)