diff --git a/tardis/data/tardis_config_definition.yml b/tardis/data/tardis_config_definition.yml index cbff78d9186..6e318bd5bc8 100644 --- a/tardis/data/tardis_config_definition.yml +++ b/tardis/data/tardis_config_definition.yml @@ -116,71 +116,76 @@ plasma: model: structure: - property_type : container-property - type: - property_type: container-declaration - containers: ['file', 'specific'] - _file: ['filename','filetype'] - +file: ['v_inner_boundary','v_outer_boundary'] - _specific: ['specific-property'] - - - filename: + property_type : container-property + type: + property_type: container-declaration + containers: ['file', 'specific'] + _file: ['filename','filetype'] + +file: ['v_inner_boundary','v_outer_boundary'] + _specific: ['density', 'velocity'] + + + filename: property_type: string default: None mandatory: True help: file name (with path) to structure model - filetype: + filetype: property_type: string default: None mandatory: True help: file type + #### there are only a handful of types available how do we validate that #### - - v_inner_boundary: - property_type: quantity - default: 0 km/s - mandatory: False - help: location of the inner boundary chosen from the model - - v_outer_boundary: - property_type: quantity - default: inf km/s - mandatory: False - help: location of the inner boundary chosen from the model - - specific_property: - velocity: - property_type: quantity_range - default: None - mandatory: True - help: location of boundaries in the velocity field. There will be n-1 cells as this specifis both the inner and outer velocity components - - - density: - property_type: container-property - type: - property_type: container-declaration - containers: ['branch85_w7'] - - _branch85_w7: ['branch85_w7-property'] # list - - branch85_w7-property: - time_0: - property_type: quantity - default: 19.9999584 s - mandatory: False - help: This needs no change - DO NOT TOUCH - - density_coefficient: - property_type: float - default: 3e29 - mandatory: False - help: This needs no change - DO NOT TOUCH - + + v_inner_boundary: + property_type: quantity + default: 0 km/s + mandatory: False + help: location of the inner boundary chosen from the model + + v_outer_boundary: + property_type: quantity + default: inf km/s + mandatory: False + help: location of the inner boundary chosen from the model + +# specific_property: +# velocity: +# property_type: quantity_range +# default: None +# mandatory: True +# help: location of boundaries in the velocity field. There will be n-1 cells as this specifis both the inner and outer velocity components + + velocity: + property_type: quantity_range_sampled + default: None + mandatory: True + help: description of the boundaries of the shells + + density: + property_type: container-property + type: + property_type: container-declaration + containers: ['branch85_w7'] + +branch85_w7: ['time_0', 'density_coefficient'] + + + time_0: + property_type: quantity + default: 19.9999584 s + mandatory: False + help: This needs no change - DO NOT TOUCH + + density_coefficient: + property_type: float + default: 3e29` + mandatory: False + help: This needs no change - DO NOT TOUCH + abundances: property_type: container-property type: diff --git a/tardis/io/config_reader.py b/tardis/io/config_reader.py index 196fefbc4b5..ea969b62a35 100644 --- a/tardis/io/config_reader.py +++ b/tardis/io/config_reader.py @@ -709,7 +709,7 @@ def from_config_dict(cls, config_dict, atom_data=None, test_parser=False, #Parsing supernova dictionary - validated_config_dict['supernova'] = parse_supernova_section(validated_config_dict['supernova']) + #validated_config_dict['supernova'] = parse_supernova_section(validated_config_dict['supernova']) #Parsing the model section model_section = validated_config_dict.pop('model') @@ -718,7 +718,7 @@ def from_config_dict(cls, config_dict, atom_data=None, test_parser=False, mean_densities = None abundances = None - + 1/0 if 'file' in model_section: v_inner, v_outer, mean_densities, abundances = parse_model_file_section(model_section.pop('file'), validated_config_dict['supernova']['time_explosion']) diff --git a/tardis/io/config_validator.py b/tardis/io/config_validator.py index 251387a1ae4..f0c8b0fd65b 100644 --- a/tardis/io/config_validator.py +++ b/tardis/io/config_validator.py @@ -346,6 +346,11 @@ def to_type(self, value): quantity_split = value.strip().split() quantity_value = quantity_split[0] quantity_unit = ' '.join(quantity_split[1:]) + if quantity_unit.strip() == 'log_lsun': + quantity_value = 10 ** (float(quantity_value) + + np.log10(constants.L_sun.cgs.value)) + quantity_unit = 'erg/s' + return float(quantity_value) * units.Unit(quantity_unit) @@ -353,9 +358,11 @@ class PropertyTypeQuantityRange(PropertyTypeQuantity): @staticmethod def _to_units(los): if len(los) > 2: - loq = [(lambda x: (units.Quantity(float(x[0]), x[1])))(x.split()) for x in los[:-1]] + loq = [(lambda x: (units.Quantity(float(x[0]), x[1])))(x.split()) + for x in los[:-1]] else: - loq = [(lambda x: (units.Quantity(float(x[0]), x[1])))(x.split()) for x in los] + loq = [(lambda x: (units.Quantity(float(x[0]), x[1])))(x.split()) + for x in los] try: _ = reduce((lambda a, b: a.to(b.unit)), loq) loq = [a.to(loq[0].unit) for a in loq]