import pandas as pd
import numpy as np

cell_a = 77.25
cell_b = 77.25
cell_c = 38.66

def ReadPhenixSFs(in_cns):
	"""
	Takes SFs of model generated by Phenix Fmodel calculator in cns format
	Reads SFs and returns data frame with hkl indices 
	"""
	cns = pd.read_csv(in_cns,header=None,sep='\s+',engine='python',\
		names=['a','h','k','l','b','Fmodel','Pmodel'],skiprows=4)
	cns.drop(columns=['a','b'],inplace=True)
	cns['res'] = 1/np.sqrt((cns.h/cell_a)**2 + (cns.k/cell_b)**2 + (cns.l/cell_c)**2)
	cns['hkl'] = cns.h.apply(lambda x:str(x)) + ' ' + cns.k.apply(lambda x:str(x)) +\
	' ' + cns.l.apply(lambda x:str(x))
	cns.set_index('hkl',inplace=True)
	cns.sort_values(by='Fmodel',ascending=False,inplace=True)
	return cns


def ReadXDSAscii(in_ascii):
	"""
	Takes hkl asci file generated by XDS-correct
	Returns a dataframe with Fhkl and hkl indices   
	"""
	asci = pd.read_csv(in_ascii,header=None, sep='\s+', engine='python', \
	names=['h','k','l','Iasci','sigIasci','xd','yd','zd','rlp','peak','corr','psi'],\
	skiprows=47,skipfooter=1)
	asci['res'] = 1/np.sqrt((asci.h/cell_a)**2 + (asci.k/cell_b)**2 + (asci.l/cell_c)**2)
	asci['hkl'] = asci.h.apply(lambda x:str(x)) + ' ' + asci.k.apply(lambda x:str(x)) +\
 	' ' + asci.l.apply(lambda x:str(x))
	asci.set_index('hkl',inplace=True)
	asci.sort_values(by='Iasci',ascending=False,inplace=True)
	return asci


d9df00346671c4f080307863de2bac52804fe3da
<mask token>


def ReadPhenixSFs(in_cns):
    """
	Takes SFs of model generated by Phenix Fmodel calculator in cns format
	Reads SFs and returns data frame with hkl indices 
	"""
    cns = pd.read_csv(in_cns, header=None, sep='\\s+', engine='python',
        names=['a', 'h', 'k', 'l', 'b', 'Fmodel', 'Pmodel'], skiprows=4)
    cns.drop(columns=['a', 'b'], inplace=True)
    cns['res'] = 1 / np.sqrt((cns.h / cell_a) ** 2 + (cns.k / cell_b) ** 2 +
        (cns.l / cell_c) ** 2)
    cns['hkl'] = cns.h.apply(lambda x: str(x)) + ' ' + cns.k.apply(lambda x:
        str(x)) + ' ' + cns.l.apply(lambda x: str(x))
    cns.set_index('hkl', inplace=True)
    cns.sort_values(by='Fmodel', ascending=False, inplace=True)
    return cns


<mask token>

<mask token>


def ReadPhenixSFs(in_cns):
    """
	Takes SFs of model generated by Phenix Fmodel calculator in cns format
	Reads SFs and returns data frame with hkl indices 
	"""
    cns = pd.read_csv(in_cns, header=None, sep='\\s+', engine='python',
        names=['a', 'h', 'k', 'l', 'b', 'Fmodel', 'Pmodel'], skiprows=4)
    cns.drop(columns=['a', 'b'], inplace=True)
    cns['res'] = 1 / np.sqrt((cns.h / cell_a) ** 2 + (cns.k / cell_b) ** 2 +
        (cns.l / cell_c) ** 2)
    cns['hkl'] = cns.h.apply(lambda x: str(x)) + ' ' + cns.k.apply(lambda x:
        str(x)) + ' ' + cns.l.apply(lambda x: str(x))
    cns.set_index('hkl', inplace=True)
    cns.sort_values(by='Fmodel', ascending=False, inplace=True)
    return cns


def ReadXDSAscii(in_ascii):
    """
	Takes hkl asci file generated by XDS-correct
	Returns a dataframe with Fhkl and hkl indices   
	"""
    asci = pd.read_csv(in_ascii, header=None, sep='\\s+', engine='python',
        names=['h', 'k', 'l', 'Iasci', 'sigIasci', 'xd', 'yd', 'zd', 'rlp',
        'peak', 'corr', 'psi'], skiprows=47, skipfooter=1)
    asci['res'] = 1 / np.sqrt((asci.h / cell_a) ** 2 + (asci.k / cell_b) **
        2 + (asci.l / cell_c) ** 2)
    asci['hkl'] = asci.h.apply(lambda x: str(x)) + ' ' + asci.k.apply(lambda
        x: str(x)) + ' ' + asci.l.apply(lambda x: str(x))
    asci.set_index('hkl', inplace=True)
    asci.sort_values(by='Iasci', ascending=False, inplace=True)
    return asci

<mask token>
cell_a = 77.25
cell_b = 77.25
cell_c = 38.66


def ReadPhenixSFs(in_cns):
    """
	Takes SFs of model generated by Phenix Fmodel calculator in cns format
	Reads SFs and returns data frame with hkl indices 
	"""
    cns = pd.read_csv(in_cns, header=None, sep='\\s+', engine='python',
        names=['a', 'h', 'k', 'l', 'b', 'Fmodel', 'Pmodel'], skiprows=4)
    cns.drop(columns=['a', 'b'], inplace=True)
    cns['res'] = 1 / np.sqrt((cns.h / cell_a) ** 2 + (cns.k / cell_b) ** 2 +
        (cns.l / cell_c) ** 2)
    cns['hkl'] = cns.h.apply(lambda x: str(x)) + ' ' + cns.k.apply(lambda x:
        str(x)) + ' ' + cns.l.apply(lambda x: str(x))
    cns.set_index('hkl', inplace=True)
    cns.sort_values(by='Fmodel', ascending=False, inplace=True)
    return cns


def ReadXDSAscii(in_ascii):
    """
	Takes hkl asci file generated by XDS-correct
	Returns a dataframe with Fhkl and hkl indices   
	"""
    asci = pd.read_csv(in_ascii, header=None, sep='\\s+', engine='python',
        names=['h', 'k', 'l', 'Iasci', 'sigIasci', 'xd', 'yd', 'zd', 'rlp',
        'peak', 'corr', 'psi'], skiprows=47, skipfooter=1)
    asci['res'] = 1 / np.sqrt((asci.h / cell_a) ** 2 + (asci.k / cell_b) **
        2 + (asci.l / cell_c) ** 2)
    asci['hkl'] = asci.h.apply(lambda x: str(x)) + ' ' + asci.k.apply(lambda
        x: str(x)) + ' ' + asci.l.apply(lambda x: str(x))
    asci.set_index('hkl', inplace=True)
    asci.sort_values(by='Iasci', ascending=False, inplace=True)
    return asci

import pandas as pd
import numpy as np
cell_a = 77.25
cell_b = 77.25
cell_c = 38.66


def ReadPhenixSFs(in_cns):
    """
	Takes SFs of model generated by Phenix Fmodel calculator in cns format
	Reads SFs and returns data frame with hkl indices 
	"""
    cns = pd.read_csv(in_cns, header=None, sep='\\s+', engine='python',
        names=['a', 'h', 'k', 'l', 'b', 'Fmodel', 'Pmodel'], skiprows=4)
    cns.drop(columns=['a', 'b'], inplace=True)
    cns['res'] = 1 / np.sqrt((cns.h / cell_a) ** 2 + (cns.k / cell_b) ** 2 +
        (cns.l / cell_c) ** 2)
    cns['hkl'] = cns.h.apply(lambda x: str(x)) + ' ' + cns.k.apply(lambda x:
        str(x)) + ' ' + cns.l.apply(lambda x: str(x))
    cns.set_index('hkl', inplace=True)
    cns.sort_values(by='Fmodel', ascending=False, inplace=True)
    return cns


def ReadXDSAscii(in_ascii):
    """
	Takes hkl asci file generated by XDS-correct
	Returns a dataframe with Fhkl and hkl indices   
	"""
    asci = pd.read_csv(in_ascii, header=None, sep='\\s+', engine='python',
        names=['h', 'k', 'l', 'Iasci', 'sigIasci', 'xd', 'yd', 'zd', 'rlp',
        'peak', 'corr', 'psi'], skiprows=47, skipfooter=1)
    asci['res'] = 1 / np.sqrt((asci.h / cell_a) ** 2 + (asci.k / cell_b) **
        2 + (asci.l / cell_c) ** 2)
    asci['hkl'] = asci.h.apply(lambda x: str(x)) + ' ' + asci.k.apply(lambda
        x: str(x)) + ' ' + asci.l.apply(lambda x: str(x))
    asci.set_index('hkl', inplace=True)
    asci.sort_values(by='Iasci', ascending=False, inplace=True)
    return asci

import pandas as pd
import numpy as np

cell_a = 77.25
cell_b = 77.25
cell_c = 38.66

def ReadPhenixSFs(in_cns):
	"""
	Takes SFs of model generated by Phenix Fmodel calculator in cns format
	Reads SFs and returns data frame with hkl indices 
	"""
	cns = pd.read_csv(in_cns,header=None,sep='\s+',engine='python',\
		names=['a','h','k','l','b','Fmodel','Pmodel'],skiprows=4)
	cns.drop(columns=['a','b'],inplace=True)
	cns['res'] = 1/np.sqrt((cns.h/cell_a)**2 + (cns.k/cell_b)**2 + (cns.l/cell_c)**2)
	cns['hkl'] = cns.h.apply(lambda x:str(x)) + ' ' + cns.k.apply(lambda x:str(x)) +\
	' ' + cns.l.apply(lambda x:str(x))
	cns.set_index('hkl',inplace=True)
	cns.sort_values(by='Fmodel',ascending=False,inplace=True)
	return cns


def ReadXDSAscii(in_ascii):
	"""
	Takes hkl asci file generated by XDS-correct
	Returns a dataframe with Fhkl and hkl indices   
	"""
	asci = pd.read_csv(in_ascii,header=None, sep='\s+', engine='python', \
	names=['h','k','l','Iasci','sigIasci','xd','yd','zd','rlp','peak','corr','psi'],\
	skiprows=47,skipfooter=1)
	asci['res'] = 1/np.sqrt((asci.h/cell_a)**2 + (asci.k/cell_b)**2 + (asci.l/cell_c)**2)
	asci['hkl'] = asci.h.apply(lambda x:str(x)) + ' ' + asci.k.apply(lambda x:str(x)) +\
 	' ' + asci.l.apply(lambda x:str(x))
	asci.set_index('hkl',inplace=True)
	asci.sort_values(by='Iasci',ascending=False,inplace=True)
	return asci

