def __init__(self, f_choices, sigf_choices, sg_num, *args, **kwargs): super(MRForm, self).__init__(*args, **kwargs) self.fields['f_value'].choices = f_choices self.fields['sigf_value'].choices = sigf_choices sgroups = utils.getGroupNumbersFromNumber(sg_num) sg_choices = [] for sg in sgroups: sg_choices.append((sg, utils.sgNumNameTrans(number=sg))) self.fields['space_group'].choices = sg_choices self.fields['space_group'].initial = \ (sg_num, utils.sgNumNameTrans(number=sg_num))
def __init__(self, f_choices, sigf_choices, sg_num, *args, **kwargs): """ A custom initialiser which translates between spacegroup numbers and names, and sets up choices for F and SIGF columns. :param f_choices: list of choices for the F column as taken from MTZ parser. :type f_choices: list of strings :param sigf_choices: list of choices for the SIGF column as taken from MTZ parser. :type sigf_choices: list of strings :param sg_num: space group number taken from the MTZ parser :type sg_num: integer """ super(ParamForm, self).__init__(*args, **kwargs) self.fields["f_value"].choices = f_choices self.fields["sigf_value"].choices = sigf_choices sgroups = utils.getGroupNumbersFromNumber(sg_num) sg_choices = [(sg, utils.sgNumNameTrans(number=sg)) for sg in sgroups] self.fields["space_group"].choices = sg_choices