code: def subset(self,logic,update=False):
          pnames = self.phenotypes
          snames = self.scored_names
          data = self.copy()
          values = []
          phenotypes = logic.phenotypes
          if len(phenotypes)==0: phenotypes = pnames
          removing = set(self.phenotypes)-set(phenotypes)
          for k in phenotypes:
              if k not in pnames: raise ValueError("phenotype must exist in defined")
              temp = data.loc[data['phenotype_calls'].apply(lambda x: x[k]==1)].copy()
              if len(removing) > 0 and temp.shape[0] > 0:
                  temp['phenotype_calls'] = temp.apply(lambda x:
                      dict([(k,v) for k,v in x['phenotype_calls'].items() if k not in removing])
                      ,1)
              values.append(temp)
          data = pd.concat(values)
          for k,v in logic.scored_calls.items():
              if k not in snames: raise ValueError("Scored name must exist in defined")
              myfilter = 0 if v == '-' else 1
              data = data.loc[data['scored_calls'].apply(lambda x: x[k]==myfilter)]
          data.microns_per_pixel = self.microns_per_pixel
          if update: 
              data['phenotype_calls'] = data['phenotype_calls'].apply(lambda x: {logic.label:1})
          data.fill_phenotype_label(inplace=True)
          data.db = self.db
          return data