# RF Indexing:
def RF_indx(x, y):
    PANsize = y  # Size of the PAN layer (height)

    Center = x    # Center of the RF
    RF_Indx1 = Center-((PANsize+1)*3)    # First RF Index
    RF_Top_row = [RF_Indx1, RF_Indx1 + PANsize, RF_Indx1 + (PANsize*2), RF_Indx1 + (PANsize*3), RF_Indx1 + (PANsize*4), RF_Indx1 + (PANsize*5), RF_Indx1 + (PANsize*6)] # top row

    PANtoE_RF = [RF_Top_row[0], RF_Top_row[0]+1, RF_Top_row[0]+2, RF_Top_row[0]+3, RF_Top_row[0]+4, RF_Top_row[0]+5, RF_Top_row[0]+6,  
                RF_Top_row[1], RF_Top_row[1]+1, RF_Top_row[1]+2, RF_Top_row[1]+3, RF_Top_row[1]+4, RF_Top_row[1]+5, RF_Top_row[1]+6, 
                RF_Top_row[2], RF_Top_row[2]+1, RF_Top_row[2]+2, RF_Top_row[2]+3, RF_Top_row[2]+4, RF_Top_row[2]+5, RF_Top_row[2]+6, 
                RF_Top_row[3], RF_Top_row[3]+1, RF_Top_row[3]+2, RF_Top_row[3]+3, RF_Top_row[3]+4, RF_Top_row[3]+5, RF_Top_row[3]+6,
                RF_Top_row[4], RF_Top_row[4]+1, RF_Top_row[4]+2, RF_Top_row[4]+3, RF_Top_row[4]+4, RF_Top_row[4]+5, RF_Top_row[4]+6, 
                RF_Top_row[5], RF_Top_row[5]+1, RF_Top_row[5]+2, RF_Top_row[5]+3, RF_Top_row[5]+4, RF_Top_row[5]+5, RF_Top_row[5]+6,
                RF_Top_row[6], RF_Top_row[6]+1, RF_Top_row[6]+2, RF_Top_row[6]+3, RF_Top_row[6]+4, RF_Top_row[6]+5, RF_Top_row[6]+6]


    I_Center = Center
    I_Center_RF_Indx1 = I_Center-((PANsize+1)*2)    # First RF Index
    I_Center_RF_Top_row = [I_Center_RF_Indx1, I_Center_RF_Indx1 + PANsize, I_Center_RF_Indx1 + (PANsize*2), I_Center_RF_Indx1 + (PANsize*3), I_Center_RF_Indx1 + (PANsize*4)] # top row

    PANtoICenter = [I_Center_RF_Top_row[0], I_Center_RF_Top_row[0]+1, I_Center_RF_Top_row[0]+2, I_Center_RF_Top_row[0]+3, I_Center_RF_Top_row[0]+4,  
                    I_Center_RF_Top_row[1], I_Center_RF_Top_row[1]+1, I_Center_RF_Top_row[1]+2, I_Center_RF_Top_row[1]+3, I_Center_RF_Top_row[1]+4, 
                    I_Center_RF_Top_row[2], I_Center_RF_Top_row[2]+1, I_Center_RF_Top_row[2]+2, I_Center_RF_Top_row[2]+3, I_Center_RF_Top_row[2]+4,
                    I_Center_RF_Top_row[3], I_Center_RF_Top_row[3]+1, I_Center_RF_Top_row[3]+2, I_Center_RF_Top_row[3]+3, I_Center_RF_Top_row[3]+4,
                    I_Center_RF_Top_row[4], I_Center_RF_Top_row[4]+1, I_Center_RF_Top_row[4]+2, I_Center_RF_Top_row[4]+3, I_Center_RF_Top_row[4]+4]


    I_Top = I_Center - 3
    I_Top_RF_Indx1 = I_Top-((PANsize+1)*2)    # First RF Index
    I_Top_RF_Top_row = [I_Top_RF_Indx1, I_Top_RF_Indx1 + PANsize, I_Top_RF_Indx1 + (PANsize*2), I_Top_RF_Indx1 + (PANsize*3), I_Top_RF_Indx1 + (PANsize*4)]  # top row

    PANtoITop = [I_Top_RF_Top_row[0], I_Top_RF_Top_row[0]+1, I_Top_RF_Top_row[0]+2, I_Top_RF_Top_row[0]+3, I_Top_RF_Top_row[0]+4,  
                    I_Top_RF_Top_row[1], I_Top_RF_Top_row[1]+1, I_Top_RF_Top_row[1]+2, I_Top_RF_Top_row[1]+3, I_Top_RF_Top_row[1]+4, 
                    I_Top_RF_Top_row[2], I_Top_RF_Top_row[2]+1, I_Top_RF_Top_row[2]+2, I_Top_RF_Top_row[2]+3, I_Top_RF_Top_row[2]+4,
                    I_Top_RF_Top_row[3], I_Top_RF_Top_row[3]+1, I_Top_RF_Top_row[3]+2, I_Top_RF_Top_row[3]+3, I_Top_RF_Top_row[3]+4,
                    I_Top_RF_Top_row[4], I_Top_RF_Top_row[4]+1, I_Top_RF_Top_row[4]+2, I_Top_RF_Top_row[4]+3, I_Top_RF_Top_row[4]+4]

    I_Bottom = I_Center + 3
    I_Bottom_RF_Indx1 = I_Bottom-((PANsize+1)*2)    # First RF Index
    I_Bottom_RF_Bottom_row = [I_Bottom_RF_Indx1, I_Bottom_RF_Indx1 + PANsize, I_Bottom_RF_Indx1 + (PANsize*2), I_Bottom_RF_Indx1 + (PANsize*3), I_Bottom_RF_Indx1 + (PANsize*4)]  # top row

    PANtoIBottom = [I_Bottom_RF_Bottom_row[0], I_Bottom_RF_Bottom_row[0]+1, I_Bottom_RF_Bottom_row[0]+2, I_Bottom_RF_Bottom_row[0]+3, I_Bottom_RF_Bottom_row[0]+4,  
                    I_Bottom_RF_Bottom_row[1], I_Bottom_RF_Bottom_row[1]+1, I_Bottom_RF_Bottom_row[1]+2, I_Bottom_RF_Bottom_row[1]+3, I_Bottom_RF_Bottom_row[1]+4, 
                    I_Bottom_RF_Bottom_row[2], I_Bottom_RF_Bottom_row[2]+1, I_Bottom_RF_Bottom_row[2]+2, I_Bottom_RF_Bottom_row[2]+3, I_Bottom_RF_Bottom_row[2]+4,
                    I_Bottom_RF_Bottom_row[3], I_Bottom_RF_Bottom_row[3]+1, I_Bottom_RF_Bottom_row[3]+2, I_Bottom_RF_Bottom_row[3]+3, I_Bottom_RF_Bottom_row[3]+4,
                    I_Bottom_RF_Bottom_row[4], I_Bottom_RF_Bottom_row[4]+1, I_Bottom_RF_Bottom_row[4]+2, I_Bottom_RF_Bottom_row[4]+3, I_Bottom_RF_Bottom_row[4]+4]


    I_Left = I_Center - (PANsize*3)
    I_Left_RF_Indx1 = I_Left-((PANsize+1)*2)    # First RF Index
    I_Left_RF_Left_row = [I_Left_RF_Indx1, I_Left_RF_Indx1 + PANsize, I_Left_RF_Indx1 + (PANsize*2), I_Left_RF_Indx1 + (PANsize*3), I_Left_RF_Indx1 + (PANsize*4)]  # top row

    PANtoILeft = [I_Left_RF_Left_row[0], I_Left_RF_Left_row[0]+1, I_Left_RF_Left_row[0]+2, I_Left_RF_Left_row[0]+3, I_Left_RF_Left_row[0]+4,  
                    I_Left_RF_Left_row[1], I_Left_RF_Left_row[1]+1, I_Left_RF_Left_row[1]+2, I_Left_RF_Left_row[1]+3, I_Left_RF_Left_row[1]+4, 
                    I_Left_RF_Left_row[2], I_Left_RF_Left_row[2]+1, I_Left_RF_Left_row[2]+2, I_Left_RF_Left_row[2]+3, I_Left_RF_Left_row[2]+4,
                    I_Left_RF_Left_row[3], I_Left_RF_Left_row[3]+1, I_Left_RF_Left_row[3]+2, I_Left_RF_Left_row[3]+3, I_Left_RF_Left_row[3]+4,
                    I_Left_RF_Left_row[4], I_Left_RF_Left_row[4]+1, I_Left_RF_Left_row[4]+2, I_Left_RF_Left_row[4]+3, I_Left_RF_Left_row[4]+4]

    I_Right = I_Center + (PANsize*3)
    I_Right_RF_Indx1 = I_Right-((PANsize+1)*2)    # First RF Index
    I_Right_RF_Right_row = [I_Right_RF_Indx1, I_Right_RF_Indx1 + PANsize, I_Right_RF_Indx1 + (PANsize*2), I_Right_RF_Indx1 + (PANsize*3), I_Right_RF_Indx1 + (PANsize*4)]   # top row

    PANtoIRight = [I_Right_RF_Right_row[0], I_Right_RF_Right_row[0]+1, I_Right_RF_Right_row[0]+2, I_Right_RF_Right_row[0]+3, I_Right_RF_Right_row[0]+4,  
                    I_Right_RF_Right_row[1], I_Right_RF_Right_row[1]+1, I_Right_RF_Right_row[1]+2, I_Right_RF_Right_row[1]+3, I_Right_RF_Right_row[1]+4, 
                    I_Right_RF_Right_row[2], I_Right_RF_Right_row[2]+1, I_Right_RF_Right_row[2]+2, I_Right_RF_Right_row[2]+3, I_Right_RF_Right_row[2]+4,
                    I_Right_RF_Right_row[3], I_Right_RF_Right_row[3]+1, I_Right_RF_Right_row[3]+2, I_Right_RF_Right_row[3]+3, I_Right_RF_Right_row[3]+4,
                    I_Right_RF_Right_row[4], I_Right_RF_Right_row[4]+1, I_Right_RF_Right_row[4]+2, I_Right_RF_Right_row[4]+3, I_Right_RF_Right_row[4]+4]


    return PANtoE_RF, PANtoICenter, PANtoITop, PANtoIBottom, PANtoILeft, PANtoIRight