diff --git a/bfps/FluidResize.py b/bfps/FluidResize.py deleted file mode 100644 index fb5e26208f6960d447bc927bd9e207354620d188..0000000000000000000000000000000000000000 --- a/bfps/FluidResize.py +++ /dev/null @@ -1,156 +0,0 @@ -####################################################################### -# # -# Copyright 2015 Max Planck Institute # -# for Dynamics and Self-Organization # -# # -# This file is part of bfps. # -# # -# bfps is free software: you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published # -# by the Free Software Foundation, either version 3 of the License, # -# or (at your option) any later version. # -# # -# bfps is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with bfps. If not, see <http://www.gnu.org/licenses/> # -# # -# Contact: Cristian.Lalescu@ds.mpg.de # -# # -####################################################################### - - - -import os - -import bfps -from ._fluid_base import _fluid_particle_base - -class FluidResize(_fluid_particle_base): - """This class is meant to resize snapshots of DNS states to new grids. - Typical stuff for DNS of turbulence. - It will become superfluous when HDF5 is used for field I/O. - """ - def __init__( - self, - name = 'FluidResize-v' + bfps.__version__, - work_dir = './', - simname = 'test', - fluid_precision = 'single', - use_fftw_wisdom = False): - _fluid_particle_base.__init__( - self, - name = name + '-' + fluid_precision, - work_dir = work_dir, - simname = simname, - dtype = fluid_precision, - use_fftw_wisdom = use_fftw_wisdom) - self.parameters['src_simname'] = 'test' - self.parameters['dst_iter'] = 0 - self.parameters['dst_nx'] = 32 - self.parameters['dst_ny'] = 32 - self.parameters['dst_nz'] = 32 - self.parameters['dst_simname'] = 'new_test' - self.parameters['dst_dkx'] = 1.0 - self.parameters['dst_dky'] = 1.0 - self.parameters['dst_dkz'] = 1.0 - self.fill_up_fluid_code() - self.finalize_code() - return None - def fill_up_fluid_code(self): - self.fluid_includes += '#include <cstring>\n' - self.fluid_includes += '#include "fftw_tools.hpp"\n' - self.fluid_variables += ('double t;\n' + - 'fluid_solver<' + self.C_dtype + '> *fs0, *fs1;\n') - self.fluid_start += """ - //begincpp - char fname[512]; - fs0 = new fluid_solver<{0}>( - src_simname, - nx, ny, nz, - dkx, dky, dkz); - fs1 = new fluid_solver<{0}>( - dst_simname, - dst_nx, dst_ny, dst_nz, - dst_dkx, dst_dky, dst_dkz); - fs0->iteration = iteration; - fs1->iteration = 0; - DEBUG_MSG("about to read field\\n"); - fs0->read('v', 'c'); - DEBUG_MSG("field read, about to copy data\\n"); - double a, b; - fs0->compute_velocity(fs0->cvorticity); - a = 0.5*fs0->autocorrel(fs0->cvelocity); - b = 0.5*fs0->autocorrel(fs0->cvorticity); - DEBUG_MSG("old field %d %g %g\\n", fs0->iteration, a, b); - copy_complex_array<{0}>(fs0->cd, fs0->cvorticity, - fs1->cd, fs1->cvorticity, - 3); - DEBUG_MSG("data copied, about to write new field\\n"); - fs1->write('v', 'c'); - DEBUG_MSG("finished writing\\n"); - fs1->compute_velocity(fs1->cvorticity); - a = 0.5*fs1->autocorrel(fs1->cvelocity); - b = 0.5*fs1->autocorrel(fs1->cvorticity); - DEBUG_MSG("new field %d %g %g\\n", fs1->iteration, a, b); - //endcpp - """.format(self.C_dtype) - self.fluid_end += """ - //begincpp - delete fs0; - delete fs1; - //endcpp - """ - return None - def specific_parser_arguments( - self, - parser): - _fluid_particle_base.specific_parser_arguments(self, parser) - parser.add_argument( - '-m', - type = int, - dest = 'm', - default = 32, - metavar = 'M', - help = 'resize from N to M') - parser.add_argument( - '--src_wd', - type = str, - dest = 'src_work_dir', - required = True) - parser.add_argument( - '--src_iteration', - type = int, - dest = 'src_iteration', - required = True) - return None - def launch( - self, - args = [], - **kwargs): - opt = self.prepare_launch(args) - cmd_line_pars = vars(opt) - for k in ['dst_nx', 'dst_ny', 'dst_nz']: - if type(cmd_line_pars[k]) == type(None): - cmd_line_pars[k] = opt.m - # the 3 dst_ni have been updated in opt itself at this point - # I'm not sure if this code is future-proof... - self.parameters['niter_todo'] = 0 - self.pars_from_namespace(opt) - src_file = os.path.join( - os.path.realpath(opt.src_work_dir), - opt.src_simname + '_cvorticity_i{0:0>5x}'.format(opt.src_iteration)) - read_file = os.path.join( - self.work_dir, - opt.src_simname + '_cvorticity_i{0:0>5x}'.format(opt.src_iteration)) - self.write_par(iter0 = opt.src_iteration) - if not os.path.exists(read_file): - os.symlink(src_file, read_file) - self.run(ncpu = opt.ncpu, - hours = opt.minutes // 60, - minutes = opt.minutes % 60) - return None - diff --git a/bfps/PP.py b/bfps/PP.py index c93c9551d081b7a5a67cf56312dd3ed38e512f0f..95c5f253bfea275b01f47a10ad8adc37c8b8d53a 100644 --- a/bfps/PP.py +++ b/bfps/PP.py @@ -139,6 +139,11 @@ class PP(_code): pars['max_acceleration_estimate'] = float(10) pars['max_velocity_estimate'] = float(1) pars['histogram_bins'] = int(129) + elif dns_type == 'resize': + pars['new_nx'] = int(32) + pars['new_ny'] = int(32) + pars['new_nz'] = int(32) + pars['new_simname'] = 'test_resized' return pars def get_data_file_name(self): return os.path.join(self.work_dir, self.simname + '.h5') @@ -444,6 +449,15 @@ class PP(_code): self.parameters_to_parser_arguments( parser_joint_acc_vel_stats, parameters = self.extra_postprocessing_parameters('joint_acc_vel_stats')) + parser_resize = subparsers.add_parser( + 'resize', + help = 'get joint acceleration and velocity statistics') + self.simulation_parser_arguments(parser_resize) + self.job_parser_arguments(parser_resize) + self.parameters_to_parser_arguments(parser_resize) + self.parameters_to_parser_arguments( + parser_resize, + parameters = self.extra_postprocessing_parameters('resize')) return None def prepare_launch( self, diff --git a/bfps/__init__.py b/bfps/__init__.py index 6c220e69d877670206e411c5a0f1f1ae78c04d33..bc9b5a0563322a5c957a51d6c9fd4e4f5fc04dc3 100644 --- a/bfps/__init__.py +++ b/bfps/__init__.py @@ -47,8 +47,8 @@ sys.path.append(bfpsfolder) from host_information import host_info from .DNS import DNS +from .PP import PP from .FluidConvert import FluidConvert -from .FluidResize import FluidResize from .NavierStokes import NavierStokes from .NSVorticityEquation import NSVorticityEquation diff --git a/bfps/__main__.py b/bfps/__main__.py index c41a6ffb67f91983f7969f40bc048a2e36e23afe..0df362fc853a8c1d5bcbb8694188386f3826f9e2 100644 --- a/bfps/__main__.py +++ b/bfps/__main__.py @@ -33,7 +33,6 @@ from .PP import PP from .TEST import TEST from .NavierStokes import NavierStokes from .NSVorticityEquation import NSVorticityEquation -from .FluidResize import FluidResize from .FluidConvert import FluidConvert from .NSManyParticles import NSManyParticles @@ -55,12 +54,6 @@ def main(): 'NSVE', 'NSVE-single', 'NSVE-double'] - FRoptions = ['FluidResize', - 'FluidResize-single', - 'FluidResize-double', - 'FR', - 'FR-single', - 'FR-double'] FCoptions = ['FluidConvert'] NSMPopt = ['NSManyParticles', 'NSManyParticles-single', @@ -99,8 +92,6 @@ def main(): base_class = NavierStokes if opt.base_class in NSVEoptions: base_class = NSVorticityEquation - elif opt.base_class in FRoptions: - base_class = FluidResize elif opt.base_class in FCoptions: base_class = FluidConvert elif opt.base_class in NSMPopt: diff --git a/bfps/cpp/field.cpp b/bfps/cpp/field.cpp index e20207c15e9762b157da9e43263c5d73b2701775..b18706dafb91c071a46e5f55d435ae065f37ba13 100644 --- a/bfps/cpp/field.cpp +++ b/bfps/cpp/field.cpp @@ -1360,6 +1360,144 @@ int joint_rspace_PDF( return EXIT_SUCCESS; } +template <typename rnumber, + field_backend be, + field_components fc> +field<rnumber, be, fc> &field<rnumber, be, fc>::operator=( + const field<rnumber, be, fc> &src) +{ + TIMEZONE("field::operator="); + if (src.real_space_representation) + { + assert(this->get_nx() == src.get_nx()); + assert(this->get_ny() == src.get_ny()); + assert(this->get_nz() == src.get_nz()); + this->real_space_representation = true; + std::copy(src.data, + src.data + this->rmemlayout->local_size, + this->data); + } + else + { + this->real_space_representation = false; + // simple copy + if (this->get_nx() == src.get_nx() && + this->get_ny() == src.get_ny() && + this->get_nz() == src.get_nz()) + { + DEBUG_MSG("in operator=, doing simple copy\n"); + std::copy(src.data, + src.data + this->rmemlayout->local_size, + this->data); + } + // complicated resize + else + { + DEBUG_MSG("in operator=, doing complicated resize\n"); + int64_t slice_size = src.clayout->local_size / src.clayout->subsizes[0]; + // clean up + std::fill_n(this->data, + this->rmemlayout->local_size, + 0.0); + typename fftw_interface<rnumber>::complex *buffer; + buffer = fftw_interface<rnumber>::alloc_complex(slice_size*ncomp(fc)); + + int min_fast_dim = + (src.clayout->sizes[2] > this->clayout->sizes[2]) ? + this->clayout->sizes[2] : src.clayout->sizes[2]; + + int64_t ii0, ii1; + int64_t oi0, oi1; + int64_t delta1, delta0; + int irank, orank; + delta0 = (this->clayout->sizes[0] - src.clayout->sizes[0]); + delta1 = (this->clayout->sizes[1] - src.clayout->sizes[1]); + for (ii0=0; ii0 < int64_t(src.clayout->sizes[0]); ii0++) + { + if (ii0 <= int64_t(src.clayout->sizes[0]/2)) + { + oi0 = ii0; + if (oi0 > int64_t(this->clayout->sizes[0]/2)) + continue; + } + else + { + oi0 = ii0 + delta0; + if ((oi0 < 0) || ((int64_t(this->clayout->sizes[0]) - oi0) >= int64_t(this->clayout->sizes[0]/2))) + continue; + } + if (be == FFTW) + { + irank = src.clayout->rank[0][ii0]; + orank = this->clayout->rank[0][oi0]; + } + else + {// TODO: handle 2D layout here + } + if ((irank == orank) && + (irank == src.clayout->myrank)) + { + std::copy( + (rnumber*)(src.get_cdata() + (ii0 - src.clayout->starts[0] )*slice_size), + (rnumber*)(src.get_cdata() + (ii0 - src.clayout->starts[0] + 1)*slice_size), + (rnumber*)buffer); + } + else + { + if (src.clayout->myrank == irank) + { + MPI_Send( + (void*)(src.get_cdata() + (ii0-src.clayout->starts[0])*slice_size), + slice_size, + mpi_real_type<rnumber>::complex(), + orank, + ii0, + src.clayout->comm); + } + if (src.clayout->myrank == orank) + { + MPI_Recv( + (void*)(buffer), + slice_size, + mpi_real_type<rnumber>::complex(), + irank, + ii0, + src.clayout->comm, + MPI_STATUS_IGNORE); + } + } + if (src.clayout->myrank == orank) + { + for (ii1 = 0; ii1 < int64_t(src.clayout->sizes[1]); ii1++) + { + if (ii1 <= int64_t(src.clayout->sizes[1]/2)) + { + oi1 = ii1; + if (oi1 > int64_t(this->clayout->sizes[1]/2)) + continue; + } + else + { + oi1 = ii1 + delta1; + if ((oi1 < 0) || ((int64_t(this->clayout->sizes[1]) - oi1) >= int64_t(this->clayout->sizes[1]/2))) + continue; + } + std::copy( + (rnumber*)(buffer + (ii1*src.clayout->sizes[2]*ncomp(fc))), + (rnumber*)(buffer + (ii1*src.clayout->sizes[2] + min_fast_dim)*ncomp(fc)), + (rnumber*)(this->get_cdata() + + ((oi0 - this->clayout->starts[0])*this->clayout->sizes[1] + + oi1)*this->clayout->sizes[2]*ncomp(fc))); + } + } + } + fftw_interface<rnumber>::free(buffer); + MPI_Barrier(src.clayout->comm); + } + } + return *this; +} + template class field<float, FFTW, ONE>; template class field<float, FFTW, THREE>; template class field<float, FFTW, THREExTHREE>; diff --git a/bfps/cpp/field.hpp b/bfps/cpp/field.hpp index d8038517afa8ca7faca19d664d96d027be105445..41609acd42e1f841be8142c5dfc93fe81d53d37f 100644 --- a/bfps/cpp/field.hpp +++ b/bfps/cpp/field.hpp @@ -129,6 +129,20 @@ class field const hsize_t toffset, const std::vector<double> max_estimate); + /* access sizes */ + inline int get_nx() const + { + return this->rlayout->sizes[2]; + } + inline int get_ny() const + { + return this->rlayout->sizes[1]; + } + inline int get_nz() const + { + return this->rlayout->sizes[0]; + } + /* acess data */ inline rnumber *__restrict__ get_rdata() { @@ -145,6 +159,11 @@ class field return (typename fftw_interface<rnumber>::complex*__restrict__)this->data; } + inline typename fftw_interface<rnumber>::complex *__restrict__ get_cdata() const + { + return (typename fftw_interface<rnumber>::complex*__restrict__)this->data; + } + inline rnumber &rval(ptrdiff_t rindex, unsigned int component = 0) { assert(fc == ONE || fc == THREE); @@ -216,6 +235,8 @@ class field return *this; } + field<rnumber, be, fc>& operator=(const field<rnumber, be, fc> &src); + template <kspace_dealias_type dt> void compute_stats( kspace<be, dt> *kk, diff --git a/bfps/cpp/full_code/resize.cpp b/bfps/cpp/full_code/resize.cpp new file mode 100644 index 0000000000000000000000000000000000000000..41d68ef725ab89c9ad2d55e5f9cc014844294b71 --- /dev/null +++ b/bfps/cpp/full_code/resize.cpp @@ -0,0 +1,74 @@ +#include <string> +#include <cmath> +#include "resize.hpp" +#include "scope_timer.hpp" + + +template <typename rnumber> +int resize<rnumber>::initialize(void) +{ + this->NSVE_field_stats<rnumber>::initialize(); + DEBUG_MSG("after NSVE_field_stats::initialize\n"); + hid_t parameter_file = H5Fopen( + (this->simname + std::string(".h5")).c_str(), + H5F_ACC_RDONLY, + H5P_DEFAULT); + + this->niter_out = hdf5_tools::read_value<int>( + parameter_file, "/parameters/niter_out"); + H5Fclose(parameter_file); + parameter_file = H5Fopen( + (this->simname + std::string("_post.h5")).c_str(), + H5F_ACC_RDONLY, + H5P_DEFAULT); + DEBUG_MSG("before read_vector\n"); + this->iteration_list = hdf5_tools::read_vector<int>( + parameter_file, + "/resize/parameters/iteration_list"); + + this->new_nx = hdf5_tools::read_value<int>( + parameter_file, "/resize/parameters/new_nx"); + this->new_ny = hdf5_tools::read_value<int>( + parameter_file, "/resize/parameters/new_ny"); + this->new_nz = hdf5_tools::read_value<int>( + parameter_file, "/resize/parameters/new_nz"); + this->new_simname = hdf5_tools::read_string( + parameter_file, "/resize/parameters/new_simname"); + H5Fclose(parameter_file); + + this->new_field = new field<rnumber, FFTW, THREE>( + this->new_nx, this->new_ny, this->new_nz, + this->comm, + this->vorticity->fftw_plan_rigor); + return EXIT_SUCCESS; +} + +template <typename rnumber> +int resize<rnumber>::work_on_current_iteration(void) +{ + DEBUG_MSG("entered resize::work_on_current_iteration\n"); + this->read_current_cvorticity(); + + std::string fname = ( + this->new_simname + + std::string("_fields.h5")); + *this->new_field = *this->vorticity; + this->new_field->io( + fname, + "vorticity", + this->iteration, + false); + return EXIT_SUCCESS; +} + +template <typename rnumber> +int resize<rnumber>::finalize(void) +{ + delete this->new_field; + this->NSVE_field_stats<rnumber>::finalize(); + return EXIT_SUCCESS; +} + +template class resize<float>; +template class resize<double>; + diff --git a/bfps/cpp/full_code/resize.hpp b/bfps/cpp/full_code/resize.hpp new file mode 100644 index 0000000000000000000000000000000000000000..de227c886615ad48c8d7872f6533a0ad93b65307 --- /dev/null +++ b/bfps/cpp/full_code/resize.hpp @@ -0,0 +1,67 @@ +/********************************************************************** +* * +* Copyright 2017 Max Planck Institute * +* for Dynamics and Self-Organization * +* * +* This file is part of bfps. * +* * +* bfps is free software: you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published * +* by the Free Software Foundation, either version 3 of the License, * +* or (at your option) any later version. * +* * +* bfps is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with bfps. If not, see <http://www.gnu.org/licenses/> * +* * +* Contact: Cristian.Lalescu@ds.mpg.de * +* * +**********************************************************************/ + + + +#ifndef RESIZE_HPP +#define RESIZE_HPP + +#include <cstdlib> +#include <sys/types.h> +#include <sys/stat.h> +#include <vector> +#include "base.hpp" +#include "field.hpp" +#include "field_binary_IO.hpp" +#include "full_code/NSVE_field_stats.hpp" + +template <typename rnumber> +class resize: public NSVE_field_stats<rnumber> +{ + public: + std::string new_simname; + + int new_nx; + int new_ny; + int new_nz; + + int niter_out; + + field<rnumber, FFTW, THREE> *new_field; + + resize( + const MPI_Comm COMMUNICATOR, + const std::string &simulation_name): + NSVE_field_stats<rnumber>( + COMMUNICATOR, + simulation_name){} + virtual ~resize(){} + + int initialize(void); + int work_on_current_iteration(void); + int finalize(void); +}; + +#endif//RESIZE_HPP + diff --git a/bfps/cpp/hdf5_tools.cpp b/bfps/cpp/hdf5_tools.cpp index 4328b28703ac60de7e82e4e3e729134ee3ff1520..c2ef6aaebf2538de5575627baf6403d39e749d2a 100644 --- a/bfps/cpp/hdf5_tools.cpp +++ b/bfps/cpp/hdf5_tools.cpp @@ -1,4 +1,6 @@ #include "hdf5_tools.hpp" +#include <cfloat> +#include <climits> int hdf5_tools::require_size_single_dataset(hid_t dset, int tsize) { @@ -136,6 +138,37 @@ std::vector<number> hdf5_tools::read_vector( return result; } +template <typename number> +number hdf5_tools::read_value( + const hid_t group, + const std::string dset_name) +{ + number result; + hid_t dset; + hid_t mem_dtype; + if (typeid(number) == typeid(int)) + mem_dtype = H5Tcopy(H5T_NATIVE_INT); + else if (typeid(number) == typeid(double)) + mem_dtype = H5Tcopy(H5T_NATIVE_DOUBLE); + if (H5Lexists(group, dset_name.c_str(), H5P_DEFAULT)) + { + dset = H5Dopen(group, dset_name.c_str(), H5P_DEFAULT); + H5Dread(dset, mem_dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, &result); + H5Dclose(dset); + } + else + { + DEBUG_MSG("attempted to read dataset %s which does not exist.\n", + dset_name.c_str()); + if (typeid(number) == typeid(int)) + result = INT_MAX; + else if (typeid(number) == typeid(double)) + result = number(DBL_MAX); + } + H5Tclose(mem_dtype); + return result; +} + template <typename dtype> std::vector<dtype> hdf5_tools::read_vector_with_single_rank( const int myrank, @@ -214,3 +247,13 @@ std::vector<double> hdf5_tools::read_vector_with_single_rank<double>( const hid_t file_id, const std::string dset_name); +template +int hdf5_tools::read_value<int>( + const hid_t, + const std::string); + +template +double hdf5_tools::read_value<double>( + const hid_t, + const std::string); + diff --git a/bfps/cpp/hdf5_tools.hpp b/bfps/cpp/hdf5_tools.hpp index 456beefe362c5d0871f8014c7a1cc468614e6374..99ba45a1c25593e063e33c54521ed492822aca45 100644 --- a/bfps/cpp/hdf5_tools.hpp +++ b/bfps/cpp/hdf5_tools.hpp @@ -79,6 +79,11 @@ namespace hdf5_tools std::string read_string( const hid_t group, const std::string dset_name); + + template <typename number> + number read_value( + const hid_t group, + const std::string dset_name); } #endif//HDF5_TOOLS_HPP diff --git a/bfps/test/test_bfps_resize.py b/bfps/test/test_bfps_resize.py new file mode 100644 index 0000000000000000000000000000000000000000..ce0a051da909a34b3be9d7ebd15e0d923c0a09f6 --- /dev/null +++ b/bfps/test/test_bfps_resize.py @@ -0,0 +1,113 @@ +#! /usr/bin/env python + +import os +import numpy as np +import h5py +import sys + +import bfps +from bfps import DNS +from bfps import PP + +import matplotlib.pyplot as plt +import pyfftw + + +def main(): + niterations = 2 + c = DNS() + c.launch( + ['NSVE', + '-n', '32', + '--src-simname', 'B32p1e4', + '--src-wd', bfps.lib_dir + '/test', + '--src-iteration', '0', + '--simname', 'dns_test', + '--np', '4', + '--ntpp', '1', + '--niter_todo', '{0}'.format(niterations), + '--niter_out', '{0}'.format(niterations), + '--niter_stat', '1', + '--wd', './'] + + sys.argv[1:]) + rr = PP() + rr.launch( + ['resize', + '--simname', 'dns_test', + '--new_nx', '64', + '--new_ny', '64', + '--new_nz', '64', + '--new_simname', 'pp_resize_test', + '--np', '4', + '--ntpp', '1', + '--iter0', '0', + '--iter1', '{0}'.format(niterations), + '--wd', './'] + + sys.argv[1:]) + f0 = h5py.File(c.get_checkpoint_0_fname(), 'r') + f1 = h5py.File('pp_resize_test_fields.h5', 'r') + d0 = f0['vorticity/complex/0'].value + d1 = f1['vorticity/complex/0'].value + small_kdata = pyfftw.n_byte_align_empty( + (32, 32, 17, 3), + pyfftw.simd_alignment, + dtype = c.ctype) + small_rdata = pyfftw.n_byte_align_empty( + (32, 32, 32, 3), + pyfftw.simd_alignment, + dtype = c.rtype) + small_plan = pyfftw.FFTW( + small_kdata.transpose((1, 0, 2, 3)), + small_rdata, + axes = (0, 1, 2), + direction = 'FFTW_BACKWARD', + threads = 4) + big_kdata = pyfftw.n_byte_align_empty( + (64, 64, 33, 3), + pyfftw.simd_alignment, + dtype = c.ctype) + big_rdata = pyfftw.n_byte_align_empty( + (64, 64, 64, 3), + pyfftw.simd_alignment, + dtype = c.rtype) + big_plan = pyfftw.FFTW( + big_kdata.transpose((1, 0, 2, 3)), + big_rdata, + axes = (0, 1, 2), + direction = 'FFTW_BACKWARD', + threads = 4) + small_kdata[:] = d0 + big_kdata[:] = d1 + small_plan.execute() + big_plan.execute() + + se = np.mean(small_rdata**2, axis = 3)**.5 + be = np.mean(big_rdata**2, axis = 3)**.5 + + f = plt.figure(figsize = (6, 4)) + a = f.add_subplot(231) + a.set_axis_off() + a.imshow(se[0]) + a = f.add_subplot(234) + a.set_axis_off() + a.imshow(be[0]) + a = f.add_subplot(232) + a.set_axis_off() + a.imshow(se[:, 0]) + a = f.add_subplot(235) + a.set_axis_off() + a.imshow(be[:, 0]) + a = f.add_subplot(233) + a.set_axis_off() + a.imshow(se[:, :, 0]) + a = f.add_subplot(236) + a.set_axis_off() + a.imshow(be[:, :, 0]) + f.tight_layout() + f.savefig('resize_test.pdf') + plt.close(f) + return None + +if __name__ == '__main__': + main() + diff --git a/setup.py b/setup.py index b03bd4f4268cdaac9e16bdb3fe68384aae7958a3..d837670f1edadb54b26a3ed4f4090c4a4c2052d4 100644 --- a/setup.py +++ b/setup.py @@ -94,6 +94,7 @@ src_file_list = ['full_code/joint_acc_vel_stats', 'full_code/field_test', 'hdf5_tools', 'full_code/get_rfields', + 'full_code/resize', 'full_code/NSVE_field_stats', 'full_code/native_binary_to_hdf5', 'full_code/postprocess',