pyts icon indicating copy to clipboard operation
pyts copied to clipboard

For the images part, it seems to accept same width and height of images (ex: 32*32) and not different width and height (ex: 32*39). Any fix?

Open zneha opened this issue 4 years ago • 12 comments

Description

Steps/Code to Reproduce

<< your code here >>

Versions

zneha avatar Mar 04 '20 22:03 zneha

Are you talking about the algorithms in the pyts.image module? For all of them it does not make much sense to have different width and height, since the idea overall is to get some information between time points: f(x_i, x_j).

johannfaouzi avatar Mar 05 '20 08:03 johannfaouzi

Yes it’s for the algorithms in pyts. I am using this module for a different purpose and was wondering if I could use it to generate different width and height images.

Ex: To get an image from data of length 1225, we can give size of image to be 35*35, but what if we give data of length 1248? I cannot definitely have same width and height in this case.

On Thu, Mar 5, 2020 at 3:14 AM Johann Faouzi [email protected] wrote:

Are you talking about the algorithms in the pyts.image https://pyts.readthedocs.io/en/stable/api.html#module-pyts.image module? For all of them it does not make much sense to have different width and height, since the idea overall is to get some information between time points: f(x_i, x_j).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johannfaouzi/pyts/issues/67?email_source=notifications&email_token=AHYJLSKPBCWYULBY5K5K6TDRF5NODA5CNFSM4LB3ZCZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN4FHQI#issuecomment-595088321, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYJLSNV56MVJBNMD35O3NTRF5NODANCNFSM4LB3ZCZQ .

--

zneha avatar Mar 05 '20 12:03 zneha

If you give a float between 0 and 1, the size of the image will be proportional to the length of your time series.

So if you set image_size=p, the size of the image will be (ceil(p * length), ceil(p * length)).

With p=0.5 for instance, it would give:

  • ceil(0.5 * 1225) = 613
  • ceil(0.5 * 1248) = 624

johannfaouzi avatar Mar 05 '20 13:03 johannfaouzi

How can I directly input the first value as 32 and second value as 39 i.e., (ceil(p * length), ceil(p * length)) = (32,39)

On Thu, Mar 5, 2020 at 8:12 AM Johann Faouzi [email protected] wrote:

If you give a float between 0 and 1, the size of the image will be proportional to the length of your time series.

So if you set image_size=p, the size of the image will be (ceil(p * length), ceil(p * length)).

With p=0.5 for instance, it would give:

  • ceil(0.5 * 1225) = 613
  • ceil(0.5 * 1248) = 624

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johannfaouzi/pyts/issues/67?email_source=notifications&email_token=AHYJLSL26I6ILQRKTEUTKOTRF6QLLA5CNFSM4LB3ZCZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN5FWTQ#issuecomment-595221326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYJLSI6WXDDPE7CIZUXPJ3RF6QLLANCNFSM4LB3ZCZQ .

--

zneha avatar Mar 05 '20 13:03 zneha

I don't understand why you want different values as it does not make sense.

If you really want different width and height, just set image_size to the larger value (39), you will get an image with shape (39, 39) and you can crop / downsample this image so that its new shape is (32, 39).

johannfaouzi avatar Mar 05 '20 13:03 johannfaouzi

I am using the pyts module not specifically for this project. What I trying to do is take an array, say [ 1 2 3 4 5 6 ] and trying to make it into an image/ matrix, ex: [1 2 3; which is a 2*3 matrix.

      4 5 6]

So basically trying to set my image size to get a gaf/ mtf image/matrix.

I cannot crop the image as, this is leading to data drop.

On Thu, Mar 5, 2020 at 8:38 AM Johann Faouzi [email protected] wrote:

I don't understand why you want different values as it does not make sense.

If you really want different width and height, just set image_size to the larger value (39), you will get an image with shape (39, 39) and you can crop / downsample this image so that its new shape is (32, 39).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johannfaouzi/pyts/issues/67?email_source=notifications&email_token=AHYJLSPLHMXO3SEKZA53JITRF6TO5A5CNFSM4LB3ZCZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN5I3HI#issuecomment-595234205, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYJLSPMG2EVHZOOFF5YCKDRF6TO5ANCNFSM4LB3ZCZQ .

--

zneha avatar Mar 05 '20 13:03 zneha

As of now , if my array length is 1225, I am giving my input as size = 35 (expecting GramianAngularField takes my image size as 35*35) gasf = GramianAngularField(image_size = size, methos = 'summation')

Was trying to get around, if my array length is 1248, I want my image size to be 32*39, so what should be my input to GramianAngularField for the size parameter?

On Thu, Mar 5, 2020 at 8:43 AM Neha Reddy Sanagala [email protected] wrote:

I am using the pyts module not specifically for this project. What I trying to do is take an array, say [ 1 2 3 4 5 6 ] and trying to make it into an image/ matrix, ex: [1 2 3; which is a 2*3 matrix.

        4 5 6]

So basically trying to set my image size to get a gaf/ mtf image/matrix.

I cannot crop the image as, this is leading to data drop.

On Thu, Mar 5, 2020 at 8:38 AM Johann Faouzi [email protected] wrote:

I don't understand why you want different values as it does not make sense.

If you really want different width and height, just set image_size to the larger value (39), you will get an image with shape (39, 39) and you can crop / downsample this image so that its new shape is (32, 39).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johannfaouzi/pyts/issues/67?email_source=notifications&email_token=AHYJLSPLHMXO3SEKZA53JITRF6TO5A5CNFSM4LB3ZCZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN5I3HI#issuecomment-595234205, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYJLSPMG2EVHZOOFF5YCKDRF6TO5ANCNFSM4LB3ZCZQ .

--

--

zneha avatar Mar 05 '20 13:03 zneha

The thing is that there is no relationship of this kind. If you want to transform your 1D-time series into an 2D-array without performing in any modification of the values, you can use numpy.reshape. But it is totally different from what the algorithms in the pyts.image module do.

johannfaouzi avatar Mar 05 '20 14:03 johannfaouzi

Is it not that, this entire module is to convert a time series to a matrix (image esentially)?

zneha avatar Mar 05 '20 15:03 zneha

Yes, and the image will always be a square matrix.

johannfaouzi avatar Mar 05 '20 15:03 johannfaouzi

Any way that I could get a rectangular image?

On Thu, Mar 5, 2020 at 10:21 AM Johann Faouzi [email protected] wrote:

Yes, and the image will always be a square matrix.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johannfaouzi/pyts/issues/67?email_source=notifications&email_token=AHYJLSM5HZVQDSG2WOWNIOLRF67Q7A5CNFSM4LB3ZCZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEN5VOSQ#issuecomment-595285834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYJLSNHRN4OD227FDER7WTRF67Q7ANCNFSM4LB3ZCZQ .

--

Neha Reddy Sanagala Graduate student, Department of Electrical Engineering & Computer Science

*AHA Precision Medicine Fellow, *Machine Learning & Artificial Intelligence Complex Adaptive Systems Lab (University of Cincinnati College of Engineering and Applied Science) Computational Lab, AI Center of Excellence (University of Cincinnati College of Medicine, Cardiovascular Research Center)

zneha avatar Mar 05 '20 17:03 zneha

No.

johannfaouzi avatar Mar 06 '20 08:03 johannfaouzi