-
Notifications
You must be signed in to change notification settings - Fork 4
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
Chimerapy function + test #45
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nearly there just a few small things
chimerapy/chimera_func_test.py
Outdated
# Assuming process_solar_images and plot_mask have been imported from your module | ||
from chimerapy.chimera_func import process_solar_images | ||
|
||
class TestSolarImageProcessing(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I should have said we use pytest and generally don't use class based tests.
chimerapy/chimera_func_test.py
Outdated
self.assertEqual(final_mask.shape, self.m171.data.shape) | ||
|
||
unique_values = np.unique(final_mask) | ||
self.assertTrue(np.all(np.isin(unique_values, [0, 1]))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really want to test the mask matches the expected mask given the data
chimerapy/chimera_func_test.py
Outdated
if __name__ == "__main__": | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
if __name__ == "__main__": | |
unittest.main() |
examples/paper-figures.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were these changes on purpose?
chimerapy/chimera_func.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename this to just chimera.py
chimerapy/chimera_func.py
Outdated
from sunpy.map import all_coordinates_from_map, coordinate_is_on_solar_disk | ||
|
||
|
||
def process_solar_images(m171, m193, m211): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def process_solar_images(m171, m193, m211): | |
def generate_candiate_mask(m171, m193, m211): |
`C:\Users\aoife\CHIMERApy\chimerapy\tests>pytest test_chimera.py test_chimera.py F [100%] ====================================================== FAILURES =======================================================
test_chimera.py:22: ......\AppData\Local\Programs\Python\Python313\Lib\site-packages\numpy\testing_private\utils.py:1674: in compare self = <Quantity [[0., 0., 0., ..., 0., 0., 0.],
E numpy._core._exceptions._ArrayMemoryError: Unable to allocate 8.00 MiB for an array with shape (1024, 1024) and data type float64 ......\AppData\Local\Programs\Python\Python313\Lib\site-packages\astropy\units\quantity.py:658: MemoryError ....\examples\paper_figures.py:349 ....\examples\paper_figures.py:349 ....\examples\paper_figures.py:352 ....\examples\paper_figures.py:352 ....\examples\paper_figures.py:355 ....\examples\paper_figures.py:355 ......\AppData\Local\Programs\Python\Python313\Lib\site-packages\astropy\visualization\lupton_rgb.py:305 ......\AppData\Local\Programs\Python\Python313\Lib\site-packages\astropy\visualization\basic_rgb.py:153 ....\examples\paper_figures.py:362 ....\examples\paper_figures.py:362 ....\examples\paper_figures.py:370 ....\examples\paper_figures.py:370 chimerapy/tests/test_chimera.py::test_generate_candidate_mask chimerapy/tests/test_chimera.py::test_generate_candidate_mask chimerapy/tests/test_chimera.py::test_generate_candidate_mask chimerapy/tests/test_chimera.py::test_generate_candidate_mask chimerapy/tests/test_chimera.py::test_generate_candidate_mask chimerapy/tests/test_chimera.py::test_generate_candidate_mask chimerapy/tests/test_chimera.py::test_generate_candidate_mask chimerapy/tests/test_chimera.py::test_generate_candidate_mask chimerapy/tests/test_chimera.py::test_generate_candidate_mask chimerapy/tests/test_chimera.py::test_generate_candidate_mask chimerapy/tests/test_chimera.py: 6294 warnings -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html |
Changed the Chimerapy function to include sphinx NumPy style Python docstrings and created a file to test the function