-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding check for duplicates in add_interferometer!
This commit resolves #17 add_interferometer! function has been modified to read the json file using JSON.parsefile directly and pass it to its method that takes as input a dictionary. Note that JSON.parsefile returns a Dict{String, Any} dictionary while OMAS.imas2dict constructs a Dict{Symbol, Any} dictionary. Thus after reading the josn file it is converted into a Dict{Symbol, Any}. Then a duplicacy check is run to ensure that new file has no channels that have an overlapping name or identifier. If a duplicate is found, an error is thrown and it recommends the user to use overwrite=true. In case of overwrite=true, the duplicate channels in existing ids are deletec and the new channels are added. This may change the indices of the channel in ids.interferometer.channel array. In case there is no duplicacy or overwrite=true with additional channels, the new channels are appended at the end of the ids.interferometer.channel array. Test cases have been expanded to cover the new functionality.
- Loading branch information
1 parent
15de965
commit b926763
Showing
5 changed files
with
366 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"interferometer": { | ||
"channel": [ | ||
{ | ||
"name": "V1.5", | ||
"identifier": "V1.5", | ||
"line_of_sight": { | ||
"first_point": { | ||
"phi": 0.5, | ||
"r": 5.5, | ||
"z": -5.0 | ||
}, | ||
"second_point": { | ||
"phi": 0.5, | ||
"r": 5.5, | ||
"z": 6.0 | ||
}, | ||
"third_point": { | ||
"phi": 0.5, | ||
"r": 5.5, | ||
"z": -5.0 | ||
} | ||
}, | ||
"wavelength": [ | ||
{ | ||
"value": 10.6e-6 | ||
}, | ||
{ | ||
"value": 6.33e-7 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{ | ||
"interferometer": { | ||
"channel": [ | ||
{ | ||
"name": "V1", | ||
"identifier": "V1", | ||
"line_of_sight": { | ||
"first_point": { | ||
"phi": 0.2, | ||
"r": 5.2, | ||
"z": -5.0 | ||
}, | ||
"second_point": { | ||
"phi": 0.2, | ||
"r": 5.2, | ||
"z": 6.0 | ||
}, | ||
"third_point": { | ||
"phi": 0.2, | ||
"r": 5.2, | ||
"z": -5.0 | ||
} | ||
}, | ||
"wavelength": [ | ||
{ | ||
"value": 10.6e-6 | ||
}, | ||
{ | ||
"value": 6.33e-7 | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "V2", | ||
"identifier": "V2", | ||
"line_of_sight": { | ||
"first_point": { | ||
"phi": 0.2, | ||
"r": 6.2, | ||
"z": -5.0 | ||
}, | ||
"second_point": { | ||
"phi": 0.2, | ||
"r": 6.2, | ||
"z": 6.0 | ||
}, | ||
"third_point": { | ||
"phi": 0.2, | ||
"r": 6.2, | ||
"z": -5.0 | ||
} | ||
}, | ||
"wavelength": [ | ||
{ | ||
"value": 10.6e-6 | ||
}, | ||
{ | ||
"value": 6.33e-7 | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "V3", | ||
"identifier": "V3", | ||
"line_of_sight": { | ||
"first_point": { | ||
"phi": 0.2, | ||
"r": 7.2, | ||
"z": -5.0 | ||
}, | ||
"second_point": { | ||
"phi": 0.2, | ||
"r": 7.2, | ||
"z": 6.0 | ||
}, | ||
"third_point": { | ||
"phi": 0.2, | ||
"r": 7.2, | ||
"z": -5.0 | ||
} | ||
}, | ||
"wavelength": [ | ||
{ | ||
"value": 10.6e-6 | ||
}, | ||
{ | ||
"value": 6.33e-7 | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "H1", | ||
"identifier": "H1", | ||
"line_of_sight": { | ||
"first_point": { | ||
"phi": 0.2, | ||
"r": 9.2, | ||
"z": 0.0 | ||
}, | ||
"second_point": { | ||
"phi": 0.2, | ||
"r": 3.2, | ||
"z": 0.0 | ||
}, | ||
"third_point": { | ||
"phi": 0.2, | ||
"r": 9.2, | ||
"z": 0.0 | ||
} | ||
}, | ||
"wavelength": [ | ||
{ | ||
"value": 10.6e-6 | ||
}, | ||
{ | ||
"value": 6.33e-7 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.