Repository: hyperspy/rosettasciio (language: python)

Issue:
Consistent plugin names and name alias
### Description of the change
Closes #34 

Unify the naming scheme of plugins by replacing mainly long format names. Introduces `name_aliases` field in `specifications.yaml` to allow backward compatibility for HyperSpy users

### Progress of the PR
- [x] Change implemented (can be split into several points),
- [x] update user guide (if appropriate),
- [x] add an changelog entry in the `upcoming_changes` folder (see [`upcoming_changes/README.rst`](https://github.com/hyperspy/rosettasciio/blob/main/upcoming_changes/README.rst)),
- [x] Check formatting changelog entry in the `readthedocs` doc build of this PR (link in github checks)
- [x] add tests,
- [x] ready for review.

### Reminder
- [x] Add handling of aliases to HyperSpy IO (https://github.com/hyperspy/hyperspy/pull/3009) and activate tests here (tested against corresponding HyperSpy branch)



Discussion / hints:
# [Codecov](https://codecov.io/gh/hyperspy/rosettasciio/pull/35?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy) Report
Base: **82.73**% // Head: **40.87**% // Decreases project coverage by **`-41.85%`** :warning:
> Coverage data is based on head [(`f5a36a9`)](https://codecov.io/gh/hyperspy/rosettasciio/pull/35?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy) compared to base [(`57fccc4`)](https://codecov.io/gh/hyperspy/rosettasciio/commit/57fccc4bcc19945c7a33d1d4351ee57260f9305f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy).
> Patch has no changes to coverable lines.

> :exclamation: Current head f5a36a9 differs from pull request most recent head 7a380b9. Consider uploading reports for the commit 7a380b9 to get more accurate results

<details><summary>Additional details and impacted files</summary>


```diff
@@             Coverage Diff             @@
##             main      #35       +/-   ##
===========================================
- Coverage   82.73%   40.87%   -41.86%     
===========================================
  Files          40       40               
  Lines        8032     8042       +10     
  Branches     1857     1860        +3     
===========================================
- Hits         6645     3287     -3358     
- Misses        920     4503     +3583     
+ Partials      467      252      -215     
```


| [Impacted Files](https://codecov.io/gh/hyperspy/rosettasciio/pull/35?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy) | Coverage Δ | |
|---|---|---|
| [rsciio/ripple/api.py](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy#diff-cnNjaWlvL3JpcHBsZS9hcGkucHk=) | `32.69% <ø> (-37.15%)` | :arrow_down: |
| [rsciio/jeol/api.py](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy#diff-cnNjaWlvL2plb2wvYXBpLnB5) | `4.78% <0.00%> (-80.06%)` | :arrow_down: |
| [rsciio/edax/api.py](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy#diff-cnNjaWlvL2VkYXgvYXBpLnB5) | `13.82% <0.00%> (-74.80%)` | :arrow_down: |
| [rsciio/empad/api.py](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy#diff-cnNjaWlvL2VtcGFkL2FwaS5weQ==) | `19.54% <0.00%> (-73.57%)` | :arrow_down: |
| [rsciio/dens/api.py](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy#diff-cnNjaWlvL2RlbnMvYXBpLnB5) | `12.96% <0.00%> (-70.38%)` | :arrow_down: |
| [rsciio/phenom/api.py](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy#diff-cnNjaWlvL3BoZW5vbS9hcGkucHk=) | `14.95% <0.00%> (-70.33%)` | :arrow_down: |
| [rsciio/tiff/api.py](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy#diff-cnNjaWlvL3RpZmYvYXBpLnB5) | `19.75% <0.00%> (-68.44%)` | :arrow_down: |
| [rsciio/emd/api.py](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy#diff-cnNjaWlvL2VtZC9hcGkucHk=) | `17.85% <0.00%> (-67.49%)` | :arrow_down: |
| [rsciio/msa/api.py](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy#diff-cnNjaWlvL21zYS9hcGkucHk=) | `9.30% <0.00%> (-62.31%)` | :arrow_down: |
| [rsciio/impulse/api.py](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy#diff-cnNjaWlvL2ltcHVsc2UvYXBpLnB5) | `37.33% <0.00%> (-60.01%)` | :arrow_down: |
| ... and [20 more](https://codecov.io/gh/hyperspy/rosettasciio/pull/35/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy) | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy)

</details>

[:umbrella: View full report at Codecov](https://codecov.io/gh/hyperspy/rosettasciio/pull/35?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy).   
:loudspeaker: Do you have feedback about the report comment? [Let us know in this issue](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hyperspy).

> Would it make sense to make `format_alias` a list instead of the string? I would prefer to use `format_name_aliases` instead of `format_alias` to make clear that

Indeed, I was also thinking about a list.

> Not sure if that would be for this PR but I will still mention it here! :) We should consider the case where different reader/writer can read the exact same file, as this could give the flexibility to have reader which has been develop for specific need or using different external libraries to read the data. In the same registry, we already have the `emd` case, where we have one reader which can read too different file format ("EMD velox" versus EMD, as in https://emdatasets.com). As there are different file specification, in principal, there should be separate reader. The reason I am mentioned this here is because we should start thinking about how `format_name` and `format_alias` could/should be used to deal with these issues.

I think splitting readers or the like would be a separate PR. And part of the discussion might be a separate issue. There might not always be one generic solution. For example #25 introduces a new `.xml` reader, but the JobinYvon format is so specific that it could not be read with a more generic one. There now is also a `.hdf5` format from JobinYvon, but would support for that go in the same reader (probably a lot of metadata conventions are the same, which would make it natural to keep in in the same reader as metadata handling is a large chunk of the code) or in a separate one?

But indeed, we should have that in mind in this PR. Pure manufacturer or software names should only be used, if we envision to include other formats in the same readers, which can make sense (but that is actually how it is basically handled so far).

For the moment, I see two sets of readers:
- Defined by the format extension, as makes sense for more generic formats, e.g. image formats or manufacturer independent standards such as `.msa`.
- Manufacturer specific formats usually named after the manufacturer or software.
> I think splitting readers or the like would be a separate PR. And part of the discussion might be a separate issue. There might not always be one generic solution. For example #25 introduces a new `.xml` reader, but the JobinYvon format is so specific that it could not be read with a more generic one. There now is also a `.hdf5` format from JobinYvon, but would support for that go in the same reader (probably a lot of metadata conventions are the same, which would make it natural to keep in in the same reader as metadata handling is a large chunk of the code) or in a separate one?

In case of `emd` extension, we open the file, read some metadata to determine which class should be used to read the file. We could think making this approach more generic or standardised, but not in this PR! :)

For for PR, I think we should use a list instead of a string as this would provide more flexibility.
> * rename `format_name` to `name` and `format_name_aliases` to `name_aliases`. I don't think it is necessary to specify `format` here? Sorry, I could have thought about it before!

In principle, I do prefer the simplification. From a quick check, I would have to change it in hyperspy at a few points, but deprecation is not an issue as it is only used internally and not part of the API. Right?
In hyperspy < 2.0, `format_name` is an attribute of the plugins module and this is not the case anymore in rosettasciio. As this hasn't been released, we can change it without breaking public API.
> * rename `format_name` to `name` and `format_name_aliases` to `name_aliases`. I don't think it is necessary to specify `format` here? Sorry, I could have thought about it before!
> 
> * as this is defining a specification, I would always include `format_name_aliases` even when it is empty. Currently the following will not work
>   ```python
>   for reader in IO_PLUGINS:
>     reader['format_name_aliases']
>   ```
>   as it gives a `KeyError` for the specification which doesn't have the `format_name_aliases` entry

Done
@ericpre sorry I removed your commit fixing the tests, but see that you have added it again before I could cherry-pick it.

Fix patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index aa122efa3..de7ce7bf6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -44,9 +44,7 @@ jobs:
 
       - name: Install HyperSpy (dev)
         run: |
-          #pip install https://github.com/hyperspy/hyperspy/archive/refs/heads/RELEASE_next_major.zip
-          # Remove once https://github.com/hyperspy/hyperspy/pull/3009 is merged
-          pip install https://github.com/jlaehne/hyperspy/archive/refs/heads/rsciio-format-alias.zip
+          pip install https://github.com/hyperspy/hyperspy/archive/refs/heads/RELEASE_next_major.zip
 
       - name: Test distribution
         run: |
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 5d3370cde..ac7ef81fe 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -76,9 +76,7 @@ steps:
 # Need to install hyperspy dev until hyperspy 2.0 is released
 - bash: |
     source activate $ENV_NAME
-    #pip install https://github.com/hyperspy/hyperspy/archive/refs/heads/RELEASE_next_major.zip
-    # Remove once https://github.com/hyperspy/hyperspy/pull/3009 is merged
-    pip install https://github.com/jlaehne/hyperspy/archive/refs/heads/rsciio-format-alias.zip
+    pip install https://github.com/hyperspy/hyperspy/archive/refs/heads/RELEASE_next_major.zip
     conda list
   displayName: Install (HyperSpy dev)
 


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index a2100acd2..17f911cc4 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -74,9 +74,7 @@ jobs:
         if: "!contains(matrix.LABEL, 'wo-hyperspy')"
         # Need to install hyperspy dev until hyperspy 2.0 is released
         run: |
-          #pip install https://github.com/hyperspy/hyperspy/archive/refs/heads/RELEASE_next_major.zip
-          # Remove once https://github.com/hyperspy/hyperspy/pull/3009 is merged
-          pip install https://github.com/jlaehne/hyperspy/archive/refs/heads/rsciio-format-alias.zip
+          pip install https://github.com/hyperspy/hyperspy/archive/refs/heads/RELEASE_next_major.zip
 
       - name: Pip list
         run: |