Skip to content

Commit

Permalink
(fits) automatically plot cross-section by default if reading fits cu…
Browse files Browse the repository at this point in the history
…be; also auto-plot this
  • Loading branch information
danieljprice committed Jun 19, 2024
1 parent 33df576 commit 3f086af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
25 changes: 8 additions & 17 deletions src/read_data_fits.f90
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module readdata_fits

subroutine read_data_fits(rootname,istepstart,ipos,nstepsread)
use particle_data, only:dat,npartoftype,masstype,maxcol,maxpart,headervals
use settings_data, only:ndim,ndimV,ncolumns,ncalc,ipartialread,iverbose
use settings_data, only:ndim,ndimV,ncolumns,ncalc,ipartialread,iverbose,debugmode
use mem_allocation, only:alloc
use readwrite_fits, only:read_fits_cube,fits_error,write_fits_image,&
get_floats_from_fits_header,get_velocity_from_fits_header
Expand Down Expand Up @@ -183,14 +183,16 @@ subroutine read_data_fits(rootname,istepstart,ipos,nstepsread)
centre_image = .true.
j0 = 0.5*naxes(1)
k0 = 0.5*naxes(2)
n = 0
dx = 1.*pixelscale
dy = 1.*pixelscale
dz = 1.*pixelscale
if (debugmode) print*,'DEBUG: mapping...'
!$omp parallel do private(j,k,l,n) &
!$omp shared(dat,naxes,centre_image,dx,dy,dz,j0,k0,image,i,pixelscale,ndim)
do l=1,naxes(3)
do k=1,naxes(2)
do j=1,naxes(1)
n = n + 1
n = (l-1)*naxes(1)*naxes(2) + (k-1)*naxes(1) + j
if (centre_image) then
dat(n,1,i) = (j - j0)*dx
dat(n,2,i) = (k - k0)*dy
Expand All @@ -205,19 +207,8 @@ subroutine read_data_fits(rootname,istepstart,ipos,nstepsread)
enddo
enddo
enddo
!
! set smoothing length
!
!allocate(old_image(naxes(1),naxes(2)))
!old_image = image
!call image_denoise(naxes,image,dat(1:npixels,3,i))


!
! write smoothed fits image
!
!image = image - old_image
!call write_fits_image('splash-output.fits',image,naxes,ierr)
!$omp end parallel do
if (debugmode) print*,'DEBUG: done'
!
! clean up
!
Expand Down Expand Up @@ -255,7 +246,7 @@ subroutine set_labels_fits
if (ipmass > 0) label(ipmass) = 'flux'
if (ih > 0) label(ih) = 'sigma'

if (ndim==2) iautorender = irho ! automatically select this column for first plot
if (ndim >= 2) iautorender = irho ! automatically select this column for first plot

! set labels for each particle type
ntypes = 1
Expand Down
11 changes: 10 additions & 1 deletion src/set_options_from_dataread.f90
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ subroutine set_options_dataread()
use filenames, only:rootname,nsteps,ifileopen
use labels, only:labeltype,irho,ih,get_sink_type
use asciiutils, only:ucase
use settings_render, only:icolour_particles
use settings_render, only:icolour_particles
use settings_xsecrot, only:xsec_nomulti
integer :: itype,nplot,ierr
!
!--check for errors in data read / print warnings
Expand Down Expand Up @@ -69,6 +70,14 @@ subroutine set_options_dataread()
endif
endif
endif

!--for fits cubes, turn on cross section by default if 3D
if (ndim >= 3 .and. .not.idefaults_file_read .and. ifileopen > 0) then ! only on first data read
if (index(rootname(ifileopen),'.fits') > 0) then
print "(a)",' turning cross section ON for fits cube'
xsec_nomulti = .true.
endif
endif
!
!--read exact solution parameters from files if present
!
Expand Down

0 comments on commit 3f086af

Please sign in to comment.