I would like the output files of my program to have the same label as the input files. So I used that bellow code, but it doesn’t seems that it’s working.
name = name_data[12:-6]
write(ML, "myResults/Separable_Linear_"*name*".fits")
Here’s it the name of one of my name_data: “Model_Synthetic_Star_0.2_incl=90_pa=180_e=0_wave=90”.
Thank you I got.
Here’s the solution that I found out.
name_data=“model/THENAMEOFYOURFILE.fits”, “model/” is composed of 6 char, so I should take [7:end-6]
name = name_data[7:end-6]
write(ML, "myResults/Separable_"*name*".fits")
Like that I got the same label as the input files as the output files.
Not really relevant to your question but rather than creating a variable to contain the string section and then another new string for the filename, you can use interpolation directly on the original string