<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def adjust_weights_resfile(self, resfile=None,original_ceiling=True):
 """adjusts the weights by group of the observations based on the phi components in a pest residual file so that total phi is equal to the number of non-zero weighted observations Parameters resfile : str residual file name. If None, try to use a residual file with the Pst case name. Default is None original_ceiling : bool flag to keep weights from increasing - this is generally a good idea. Default is True """

        if resfile is not None:
            self.resfile = resfile
            self.__res = None
        phi_comps = self.phi_components
        self._adjust_weights_by_phi_components(phi_comps,original_ceiling)