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

Mark/1178 supports loading swapped-axes image cubes #1194

Merged
merged 53 commits into from
Mar 22, 2023

Conversation

markccchiang
Copy link
Contributor

@markccchiang markccchiang commented Sep 8, 2022

Description

  • What is implemented or fixed? Mention the linked issue(s), if any.
    Support loading swapped axes image cubes Support loading swapped-axes image cubes (eg RA-Channel-Dec) (backend) #1178.

  • How does this PR solve the issue? Give a brief summary.
    Fix the render axes to [0, 1], i.e., the first two axes from the header. The original render axes setting is direction axes, if any.

  • Are there any companion PRs (frontend, protobuf)?
    No need to change the protobuf. But it seems the AST plot settings have to be modified in the frontend, in order to plot RA-channel or DEC-channel coordinates.
    Companion PRs: protobuf PR 77 and frontend PR 2011.

  • Is there anything else that testers should know (e.g. exactly how to reproduce the issue)?
    This is the new feature. We may need sample image cubes with swapped axes for testing.

Checklist

  • changelog updated / no changelog update needed
  • e2e test passing / added corresponding fix
  • protobuf updated to the latest dev commit / no protobuf update needed
  • added reviewers and assignee
  • added ZenHub estimate, milestone, and release

@markccchiang markccchiang changed the title Mark/1178 set render axes as 0 and 1 Mark/1178 supports loading swapped-axes image cubes Sep 11, 2022
@markccchiang markccchiang marked this pull request as ready for review November 29, 2022 05:44
@kswang1029
Copy link
Contributor

kswang1029 commented Nov 30, 2022

@markccchiang the file info for a PV image needs a fix. The offset axis is with the "NA" label. It should be "Spatial" I guess?

Screen Shot 2022-11-30 at 09 46 57

In fact maybe we can simply display CTYPE1/2/3/4, so

Shape = [256, 256, 480, 1] (X, Y, Spectral, Stokes)

becomes

Shape = [256, 256, 480, 1] (RA, DEC, FREQ, STOKES)

or

Shape = [256, 256, 480, 1] (X: RA, Y: DEC, Z: FREQ, W: STOKES)

for example.

@kswang1029
Copy link
Contributor

@markccchiang another file info issue: for a rotated cube, there is a repeated (and incorrect) "frequency range" info.

Screen Shot 2022-11-30 at 09 58 35

@pford
Copy link
Collaborator

pford commented Feb 8, 2023

Oops, this was my fault. For some reason casacore uses Freq for spectral worldAxisNames instead of the actual header value. Sorry @markccchiang you will have to change it back to iterating through header entries.

@kswang1029
Copy link
Contributor

kswang1029 commented Feb 20, 2023

to handle the general cases like
(0:ra, 1:dec, 2:stokes, 3:channel) ==> 24 combinations
(0:ra, 1:dec, 2:channel, 3:stokes) ==> 24 combinations
(0:ra, 1:dec, 2:channel) ==> 6 combinations
(0:ra, 1:dec, 2:stokes) ==> 6 combinations

we need to incorporate a general rule in the current PR to ignore stokes (if it exists) first, then from the rest, we pick up the 1st as x-axis and the 2nd as y-axis. The rest (if it exists) is z-axis (iterable via the animator). stokes (if it exists) remains as the polarization axis.

@kswang1029
Copy link
Contributor

FYI. Working on fixing and add basic e2e tests for this new feature now. Once done I will approve this PR.

@kswang1029
Copy link
Contributor

kswang1029 commented Feb 24, 2023

@markccchiang one minor issue spotted in the file info.

Name = gaussian_array_large_GALACTIC_2031.image
Data type = floatShape = [4, 746, 10, 746] (STOKES, GLON, FREQ, GLAT)
Number of channels = 10
Number of polarizations = 4
Coordinate type = Longitude, Frequency
Projection = SIN
Image reference pixels = [374, 6]
Image reference coords = [-132.27.25.3488, 1.4204e+09 Hz]
Image ref coords (deg) = [-132.457 deg, 1.4204e+09 Hz]

longitude is [0 deg, 360 deg].

Copy link
Contributor

@kswang1029 kswang1029 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feature-wise this is looking good for the current scope - supporting image visualization of a swapped-axes cube. 👍 Please proceed code review.

Copy link
Collaborator

@confluence confluence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is OK; I would just like to rename these variables. We have previously referred to the X and Y axes in the code as "spatial" rather than "direction" axes, and I think it will be less confusing if we stick to that naming convention.

@@ -175,9 +175,11 @@ std::shared_ptr<casacore::CoordinateSystem> FileLoader::GetCoordinateSystem(cons
return std::make_shared<casacore::CoordinateSystem>();
}

bool FileLoader::FindCoordinateAxes(casacore::IPosition& shape, int& spectral_axis, int& z_axis, int& stokes_axis, std::string& message) {
bool FileLoader::FindCoordinateAxes(casacore::IPosition& shape, std::vector<int>& direction_axes, int& spectral_axis, int& stokes_axis,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use "spatial" instead of "direction" in all these variables and comments, for consistency with our existing terminology.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a IIRC note, in casacore it is called directional axis. This may be why. 🙂

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only we could all decide on one standard! 😄

@kswang1029 kswang1029 self-requested a review March 14, 2023 06:40
Copy link
Contributor

@kswang1029 kswang1029 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good. new e2e tests are implemented.

@github-actions
Copy link

Code Coverage

Package Line Rate Health
src.Cache 68%
src.DataStream 52%
src.FileList 68%
src.Frame 51%
src.HttpServer 43%
src.ImageData 28%
src.ImageFitter 92%
src.ImageGenerators 52%
src.ImageStats 74%
src.Logger 44%
src.Main 54%
src.Region 22%
src.Session 30%
src.Table 52%
src.ThreadingManager 87%
src.Timer 85%
src.Util 50%
Summary 40% (6787 / 16902)

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.

4 participants