Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding check for duplicates in add_interferometer! #18

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

anchal-physics
Copy link
Collaborator

This PR 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.

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.
@anchal-physics anchal-physics merged commit 3875321 into dev Feb 14, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants