Esempio n. 1
0
def test_find_unwanted_extra_error():
    """morar.feature_selection.find_unwanted()"""
    colnames = [
        "Nuclei_Intensity_IntegratedIntensityEdge_W1",
        "Nuclei_Intensity_IntegratedIntensity_W1",
        "Nuclei_Intensity_LowerQuartileIntensity_W1",
        "Nuclei_Intensity_MADIntensity_W1",
        "Nuclei_Intensity_MassDisplacement_W1",
        "Nuclei_Intensity_MaxIntensityEdge_W1",
        "Nuclei_Intensity_MaxIntensity_W1",
        "Nuclei_Intensity_MeanIntensityEdge_W1",
        "Nuclei_Intensity_MeanIntensity_W1",
        "Nuclei_Intensity_MedianIntensity_W1",
        "Nuclei_Intensity_MinIntensityEdge_W1",
        "Nuclei_Intensity_MinIntensity_W1",
        "Nuclei_Intensity_StdIntensityEdge_W1",
        "Nuclei_Intensity_StdIntensity_W1",
        "Nuclei_Intensity_UpperQuartileIntensity_W1",
        "Nuclei_Location_CenterMassIntensity_X_W1",
        "Nuclei_Location_CenterMassIntensity_Y_W1",
        "Nuclei_Location_Center_X",
        "Nuclei_Location_Center_Y",
        "Nuclei_Location_MaxIntensity_X_W1",
        "Nuclei_Location_MaxIntensity_Y_W1",
        "Nuclei_Number_Object_Number",
        "Nuclei_Texture_AngularSecondMoment_W1_3_0",
        "Nuclei_Texture_AngularSecondMoment_W1_3_135",
        "Nuclei_Texture_AngularSecondMoment_W1_3_45",
        "Nuclei_Texture_AngularSecondMoment_W1_3_90",
    ]
    dat = np.random.randn(10, len(colnames))
    test_df = pd.DataFrame(dat, columns=colnames)
    with pytest.raises(TypeError):
        feature_selection.find_unwanted(test_df, extra=5)
def test_find_unwanted_extra_error():
    """morar.feature_selection.find_unwanted()"""
    colnames = [
        'Nuclei_Intensity_IntegratedIntensityEdge_W1',
        'Nuclei_Intensity_IntegratedIntensity_W1',
        'Nuclei_Intensity_LowerQuartileIntensity_W1',
        'Nuclei_Intensity_MADIntensity_W1',
        'Nuclei_Intensity_MassDisplacement_W1',
        'Nuclei_Intensity_MaxIntensityEdge_W1',
        'Nuclei_Intensity_MaxIntensity_W1',
        'Nuclei_Intensity_MeanIntensityEdge_W1',
        'Nuclei_Intensity_MeanIntensity_W1',
        'Nuclei_Intensity_MedianIntensity_W1',
        'Nuclei_Intensity_MinIntensityEdge_W1',
        'Nuclei_Intensity_MinIntensity_W1',
        'Nuclei_Intensity_StdIntensityEdge_W1',
        'Nuclei_Intensity_StdIntensity_W1',
        'Nuclei_Intensity_UpperQuartileIntensity_W1',
        'Nuclei_Location_CenterMassIntensity_X_W1',
        'Nuclei_Location_CenterMassIntensity_Y_W1', 'Nuclei_Location_Center_X',
        'Nuclei_Location_Center_Y', 'Nuclei_Location_MaxIntensity_X_W1',
        'Nuclei_Location_MaxIntensity_Y_W1', 'Nuclei_Number_Object_Number',
        'Nuclei_Texture_AngularSecondMoment_W1_3_0',
        'Nuclei_Texture_AngularSecondMoment_W1_3_135',
        'Nuclei_Texture_AngularSecondMoment_W1_3_45',
        'Nuclei_Texture_AngularSecondMoment_W1_3_90'
    ]
    dat = np.random.randn(10, len(colnames))
    test_df = pd.DataFrame(dat, columns=colnames)
    with pytest.raises(TypeError):
        feature_selection.find_unwanted(test_df, extra=5)
Esempio n. 3
0
def test_find_unwanted_extra():
    """morar.feature_selection.find_unwanted()"""
    colnames = [
        "Nuclei_Intensity_IntegratedIntensityEdge_W1",
        "Nuclei_Intensity_IntegratedIntensity_W1",
        "Nuclei_Intensity_LowerQuartileIntensity_W1",
        "Nuclei_Intensity_MADIntensity_W1",
        "Nuclei_Intensity_MassDisplacement_W1",
        "Nuclei_Intensity_MaxIntensityEdge_W1",
        "Nuclei_Intensity_MaxIntensity_W1",
        "Nuclei_Intensity_MeanIntensityEdge_W1",
        "Nuclei_Intensity_MeanIntensity_W1",
        "Nuclei_Intensity_MedianIntensity_W1",
        "Nuclei_Intensity_MinIntensityEdge_W1",
        "Nuclei_Intensity_MinIntensity_W1",
        "Nuclei_Intensity_StdIntensityEdge_W1",
        "Nuclei_Intensity_StdIntensity_W1",
        "Nuclei_Intensity_UpperQuartileIntensity_W1",
        "Nuclei_Location_CenterMassIntensity_X_W1",
        "Nuclei_Location_CenterMassIntensity_Y_W1",
        "Nuclei_Location_Center_X",
        "Nuclei_Location_Center_Y",
        "Nuclei_Location_MaxIntensity_X_W1",
        "Nuclei_Location_MaxIntensity_Y_W1",
        "Nuclei_Number_Object_Number",
        "Nuclei_Texture_AngularSecondMoment_W1_3_0",
        "Nuclei_Texture_AngularSecondMoment_W1_3_135",
        "Nuclei_Texture_AngularSecondMoment_W1_3_45",
        "Nuclei_Texture_AngularSecondMoment_W1_3_90",
    ]
    dat = np.random.randn(10, len(colnames))
    test_df = pd.DataFrame(dat, columns=colnames)
    ans = feature_selection.find_unwanted(test_df, extra="Std")
    unwanted = [
        "Nuclei_Location_CenterMassIntensity_X_W1",
        "Nuclei_Location_CenterMassIntensity_Y_W1",
        "Nuclei_Location_Center_X",
        "Nuclei_Location_Center_Y",
        "Nuclei_Location_MaxIntensity_X_W1",
        "Nuclei_Location_MaxIntensity_Y_W1",
        "Nuclei_Number_Object_Number",
        "Nuclei_Intensity_StdIntensityEdge_W1",
        "Nuclei_Intensity_StdIntensity_W1",
    ]
    assert sorted(ans) == sorted(unwanted)