code: def wrheader(self, write_dir=''):
          
  
          # Get all the fields used to write the header
          # sig_write_fields is a dictionary of
          # {field_name:required_channels}
          rec_write_fields, sig_write_fields = self.get_write_fields()
  
          # Check the validity of individual fields used to write the header
  
          # Record specification fields (and comments)
          for field in rec_write_fields:
              self.check_field(field)
  
          # Signal specification fields.
          for field in sig_write_fields:
              self.check_field(field, required_channels=sig_write_fields[field])
  
          # Check the cohesion of fields used to write the header
          self.check_field_cohesion(rec_write_fields, list(sig_write_fields))
  
          # Write the header file using the specified fields
          self.wr_header_file(rec_write_fields, sig_write_fields, write_dir)
docs: Write a wfdb header file. The signals are not used. Before
          writing:
          - Get the fields used to write the header for this instance.
          - Check each required field.
          - Check that the fields are cohesive with one another.
  
          Parameters
          ----------
          write_dir : str, optional
              The output directory in which the header is written.
  
          Notes
          -----
          This function does NOT call `set_defaults`. Essential fields
          must be set beforehand.